Difference between revisions of "Eprint fields default.pl"
(Added actually file name in bold.) |
m |
||
Line 2: | Line 2: | ||
{{cfgd}} | {{cfgd}} | ||
− | '''eprint_fields_default.pl'' contains configuration to set the default values for eprint fields through the '''set_eprint_defaults''' function. This usually happens when a EPrint is created but before it is given to the user to edit. | + | '''eprint_fields_default.pl''' contains configuration to set the default values for eprint fields through the '''set_eprint_defaults''' function. This usually happens when a EPrint is created but before it is given to the user to edit. |
* '''<tt>$data</tt>''' is a hash reference of the metadata which will make up the document object. Each field name is a key in the hash. | * '''<tt>$data</tt>''' is a hash reference of the metadata which will make up the document object. Each field name is a key in the hash. |
Revision as of 00:10, 31 January 2022
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
eprint_fields_default.pl contains configuration to set the default values for eprint fields through the set_eprint_defaults function. This usually happens when a EPrint is created but before it is given to the user to edit.
- $data is a hash reference of the metadata which will make up the document object. Each field name is a key in the hash.
- $repository is a Repository object.
Example
In this example, the default for type is set to article.
$c->{set_eprint_defaults} = sub { my( $data, $repository ) = @_; $data->{type} = "article"; };
N.B. There are also a number of defaults set by the EPrints::DataObj::EPrint::get_defaults method:
- dir is set to the path where files for the EPrint will be stored (e.g. EPrints 12345 will be stored in disk0/00/01/23/45).
- status_changed which is set to value of lastmod which has already been set to the current time.
- datestamp which is set to value of lastmod if eprint_status is already set to archive, (e.g. if the EPrint is being imported).