Eprint fields.pl

From EPrints Documentation
Revision as of 10:20, 10 August 2012 by Adb1a11@ecs.soton.ac.uk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

EPrint Fields

eprint_fields.pl defines all the optional fields which an EPrint object has. These fields all have mappings to the database. There are a variety of field types which you can see here here.

EPrints have a broad range of field types which enforce various constraints. Each field type has its own method of storing in the database, retrieving the value from the database, rendering the value in HTML, and rendering the input component HTML for use in workflows etc.

EPrints also has compound fields. This is a field made up of compound field definitions. This allows you to make very powerful data structures without having to worry about the complexities of how they are stored in the database.

Note removing fields from eprint_fields.pl does not usually cause data to be deleted from the database. To add or remove fields from eprint_fields.pl you must run <eprintsroot>/bin/epadmin update_database_structure <repo_id> and then reload your configuration (or restart the webserver).

Field Definition

The field list is represented by an arrayref of hashrefs. Each hashref has at minimum a name, which is the field name used when referring to the field (e.g. in search) and a type, which describes the type of data the field will hold. Depending on a field's type there may also be other compulsory fields and some optional ones. See the details of field definition on the page for that type.

$c->{fields}->{eprint} = [
          {
            'name' => 'note',
            'type' => 'longtext',
            'input_rows' => 3,
          },
          ...
];