Document fields default.pl
Appearance
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
document_fields_default.pl contains the set_document_defaults function. This function sets the default values for a Document. This usually happens when a Document 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.
- $session is a Repository object (in 3.2 or later).
- $eprint is the EPrint object to which the document belongs.
Example[edit]
In this example, the default for language is set to the ID string of for the Repository object's language, which comes from the $c->{defaultlanguage} configuration setting in languages.pl and the default for security is set to public.
$c->{set_document_defaults} = sub
{
my( $data, $session, $eprint ) = @_;
$data->{language} = $session->get_langid();
$data->{security} = "public";
};
N.B. There are also a number of defaults set by the EPrints::DataObj::Document::get_defaults method:
- pos is set to the next document position or to a bespoke position specified by $c->{ulimate_doc_pos} if it is defined.
- placement is set to the same value as pos as set above.