Difference between revisions of "Eprint fields default.pl"

From EPrints Documentation
Jump to: navigation, search
(Added actually file name in bold.)
(fixed c+p error)
 
(One intermediate revision by the same user not shown)
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 eprint object. Each field name is a key in the hash.
 
* '''<tt>$repository</tt>''' is a [[API:EPrints/Repository|Repository]] object.
 
* '''<tt>$repository</tt>''' is a [[API:EPrints/Repository|Repository]] object.
  

Latest revision as of 00:23, 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


Back to cfg.d

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 eprint 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:

  1. 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).
  2. status_changed which is set to value of lastmod which has already been set to the current time.
  3. datestamp which is set to value of lastmod if eprint_status is already set to archive, (e.g. if the EPrint is being imported).