Eprint fields default.pl

From EPrints Documentation
Revision as of 00:32, 22 January 2022 by Drn@ecs.soton.ac.uk (talk | contribs) (Added eprint_fields_default.pl)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

The set_eprint_defaults function sets the default values for a EPrint. 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.


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).