API:EPrints/DataObj/MetaField

From EPrints Documentation
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


API: Core API

Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


Contents

NAME

EPrints::DataObj::MetaField - metadata fields

User Comments


DESCRIPTION

This is an internal class that should not be used outside EPrints::Database.

User Comments


CORE METADATA FIELDS

User Comments


metafieldid (counter)

The unique identifer for the metafield.

User Comments


mfdatasetid (set)

The dataset two which this metafield belongs.

User Comments


name (text)

The name of this metafield.

User Comments


type (set)

The type of this metafield.

User Comments


provenance (set)

The provenance of this metafield.

User Comments


phrase_name (multilang, multiple)

The phrase name(s)(labels) potentially in multiple languages for this metafield.

User Comments


phrase_help (multilang, multiple)

The phrase help text(s) potentially in multiple languages for this metafield.

User Comments


required (boolean)

Whether this metafield is required for the dataset.

User Comments


multiple (boolean)

Whether this metafield can have multiple values for a data object.

User Comments


allow_null (boolean)

Whether this metafield can have a null value.

User Comments


export_as_xml (boolean)

Whether this metafield can be exported in XML.

User Comments


volatile (boolean)

Whether this metafield stores a volatile data.

User Comments


min_resolution (set)

The minimum time resolution (second, minute, hour, day, month or year) for this metafield if it is a timestamp/datestamp.

User Comments


sql_index (boolean)

Whether an SQL index should be created for this metafield.

User Comments


render_input (text)

A different or bespoke function to render the input field for this metafield.

User Comments


render_value (text)

A different or bespoke function to render the value for this metafield.

User Comments


input_ordered (boolean)

Whether the input for this metafield is ordered.

User Comments


maxlength (int)

The maximum length for this metafield if it is a text or subclass of a text field.

User Comments


browse_link (boolean)

The link to a browse view for this metafield if it is a subject metafield.

User Comments


top (text)

The top subject in the subject tree that should be used as options for this subject metafield.

User Comments


datasetid (text)

The dataset ID for this metafield, if it is a search, subobject, dataobjref, fields, itemref or file field.

User Comments


set_name (text)

The name of the file that contains the options for this namedset metafield.

User Comments


options (text)

The commas separated list of options for this set metafield.

User Comments


render_order (set)

The order to render a name if this metafield is for a name.

User Comments


hide_honourific (boolean)

Whether to hide the honourfic sub-field if this is a name metafield.

User Comments


hide_lineage (boolean)

Whether to hide the lineage sub-field if this is a name metafield.

User Comments


family_first (boolean)

Whether to render the family name sub-field before the given name if this is a name metafield.

User Comments


input_style (set)

A particular style for displaying the input form element for this metafield.

User Comments


input_rows (int)

The number of input rows for this metafield.

User Comments


input_cols (int)

The number of input columns for this metafield.

User Comments


input_boxes (int)

The number of input boxes for this metafield.

User Comments


sql_counter (text)

The name to give to the sql counter for this counter metafield. Typically the same as the metafield's name.

User Comments


default_value (text)

The default value for this metafield.

User Comments


REFERENCES AND RELATED OBJECTS

User Comments


parent (itemref)

The parent metafield this metafield belongs to, if it is a sub-field.

User Comments


fields (subobject, multiple)

Sub-fields of this metafield.

User Comments


INSTANCE VARIABLES

See EPrints::DataObj.

User Comments


METHODS

User Comments


Utility Methods

User Comments


dataset_ids

@ids = EPrints::DataObj::MetaField::dataset_ids( $repo )

Returns array of all dataset IDs for non-virtual datasets in $repo.

User Comments


render_dataset_id

$dataset_label = EPrints::DataObj::MetaField::render_dataset_id( $repo, $id )

Returns XHTML DOM rendering of phrase for dataset with $id.

User Comments


options_fromform

$options = EPrints::DataObj::MetaField::options_fromform( $value )

Returns an array reference of options from the comma-separated $value provided.

User Comments


options_toform

$options_str = EPrints::DataObj::MetaField::options_toform( $value )

Returns a comma-separated string of options from the array reference $value provided.

User Comments


boolean_fromform

$boolean = EPrints::DataObj::MetaField::boolean_fromform( $value )

Returns true or false, (literally 1 or 0) depending on the $value representation of a boolean in a form.

User Comments


boolean_toform

$boolean_str = EPrints::DataObj::MetaField::boolean_toform( $value )

Returns a string representation of a boolean ("TRUE", "FALSE" or undef) depending on the to form $value provided.

User Comments


Constructor Methods

User Comments


new_from_field

$metafield = EPrints::DataObj::MetaField->new_from_field( $repo, $field, [ $dataset ] )

Returns a new metafield data object based on $field.

$dataset is determined from dataset ID of class (i.e. metafield) if unset.

User Comments


Class Methods

User Comments


get_system_field_info

$thing = EPrints::DataObj::MetaField->get_system_field_info

Returns an array describing the system metadata fields of the metafield dataset.

User Comments


get_dataset_id

$dataset = EPrints::DataObj::MetaField->get_dataset_id

Returns the ID of the EPrints::DataSet object to which this record belongs.

User Comments


get_parent_dataset_id

$dataset = EPrints::DataObj::MetaField->get_parent_dataset_id

Returns the ID of the EPrints::DataSet object to which this record's parent belongs.

User Comments


get_defaults

$defaults = EPrints::DataObj::MetaField->get_defaults( $repo, $data, [ $dataset ] )

Returns default values for this object based on the starting $data.

Get $dataset from class if not defined.

User Comments


Object Methods

User Comments


get_property_defaults

$defaults = $metafield->get_property_defaults( $repo, $type )

Gets the property defaults for metafield $type.

User Comments


dump

$str = $metafield->dump

Dump the fields configuration as used in cfg.d.

User Comments


get_parent_id

$parent = $metafield->get_parent_id

Returns the parent ID for this metafield.

Alias for:

$metafield->value( "parent" );
 

User Comments


remove

$ok = $metafield->remove

Remove the field and any sub-fields from the database.

User Comments


config_path

$path = $metafield->config_path

Returns the root directory of the repository configuration path.

User Comments


config_filename

$filename = $metafield->config_filename( $dataset )

Returns the location of the cfg.d config file for the provided $dataset.

User Comments


phrases_filename

$filename = $metafield->phrases_filename( $langid )

Returns the location of the XML phrases file for provided $lang.

User Comments


workflow_filename

$filename = $metafield->workflow_filename( $dataset )

Returns the location of the workflow file for the provided $dataset.

User Comments


add_to_phrases

$ok = $metafield->add_to_phrases

Adds the phrases defined by this metafield to the system.

User Comments


remove_from_dataset

$ok = $metafield->remove_from_dataset

Remove this metafield from the dataset specified by its mfdatasetid value.

Returns boolean dependent on success removing from the dataset.

User Comments


add_to_database

$ok = $metafield->add_to_database

Add this metafield to the database.

Returns boolean dependent on success adding to the database.

User Comments


remove_from_database

$ok = $metafield->remove_from_database

Remove this field from the database.

Returns boolean dependent on success removing from the database.

User Comments


add_to_workflow

$ok = $metafield->add_to_workflow

Add this metafield to the workflow in the Misc. section.

Returns boolean dependent on success adding to the workflow.

User Comments


remove_from_workflow

$ok = $metafield->remove_from_workflow

Remove all occurrences of this field from the workflow. Will remove the local stage if it is empty.

Returns boolean dependent on success removing from the workflow.

User Comments


perl_struct

$data = $metafield->perl_struct( $prefix )

Returns the Perl data structure representation of this field, as you would find defined in the configuration or EPrints::DataObj classes.

If $prefix is defined returns the Perl data structure for the fields property, where $prefix is the fieldname of the parent field.

User Comments


make_field_object

$field = $metafield->make_field_object

Makes and returns a new field object based on this metafield.

User Comments


add_to_repository

$ok = $metafield->add_to_repository

Adds this field to the repository.

Returns boolean dependent on success adding to the repository.

User Comments


remove_from_repository

$ok = $mf->remove_from_repository

Remove this field from the repository.

Returns boolean dependent on success removing from the repository.

User Comments


validate

$problems = $metafield->validate( $repository )

Returns any problems associated with this metafield as an array reference.

User Comments


render_citation

$xhtml = $metafield->render_citation( [ $type, %params ] )

Returns a XHTML DOM rendering of the metafield using citation $type (of default if not provided) an specified %params.

User Comments


SEE ALSO

EPrints::DataObj and EPrints::DataSet.

User Comments


COPYRIGHT

© Copyright 2023 University of Southampton.

EPrints 3.4 is supplied by EPrints Services.

http://www.eprints.org/eprints-3.4/

LICENSE

This file is part of EPrints 3.4 http://www.eprints.org/.

EPrints 3.4 and this file are released under the terms of the GNU Lesser General Public License version 3 as published by the Free Software Foundation unless otherwise stated.

EPrints 3.4 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints 3.4. If not, see http://www.gnu.org/licenses/.

User Comments