Difference between revisions of "Document fields automatic.pl"
Line 2: | Line 2: | ||
{{cfgd}} | {{cfgd}} | ||
− | This file contains the set_document_fields_automatic function. You use this function to perform | + | This file contains the set_document_fields_automatic function. You use this function to perform a set of actions which you want to happen automatically before the [[API:EPrints/DataObj/Document|Document]] as part of the [[API:EPrints/DataObj/Document|Document]] commit() step, in which the document is written to the database. |
+ | |||
+ | $data is a hash of the metadata which will make up the document object. Each field name is a key in the hash. | ||
+ | $session is a [[API:EPrints/Repository|Repository]] object (in 3.2 or later) | ||
+ | $eprint is the [[API:EPrints/DataObj/EPrint|EPrint]] object to which the document belongs | ||
==Example== | ==Example== |
Revision as of 14:38, 18 August 2010
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
This file contains the set_document_fields_automatic function. You use this function to perform a set of actions which you want to happen automatically before the Document as part of the Document commit() step, in which the document is written to the database.
$data is a hash 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
$c->{set_document_defaults} = sub { my( $data, $session, $eprint ) = @_; $data->{language} = $session->get_langid(); $data->{security} = "public"; };