Document fields automatic.pl: Difference between revisions
⧼vector-appearance-label⧽
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
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. | 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. | ||
* $ | * $doc is the [[API:EPrints/DataObj/Document|Document]] object | ||
==Example== | ==Example== | ||
<pre> | <pre> | ||
$c->{ | $c->{set_document_automatic_fields} = sub | ||
{ | { | ||
my( $ | my( $doc ) = @_; | ||
if($doc->value("description") eq ""){ | |||
$ | $doc->value("description", "the default description"); | ||
} | |||
}; | }; | ||
</pre> | </pre> | ||
Revision as of 14:46, 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.
- $doc is the Document object
Example
$c->{set_document_automatic_fields} = sub
{
my( $doc ) = @_;
if($doc->value("description") eq ""){
$doc->value("description", "the default description");
}
};