API:EPrints/MetaField

From EPrints Documentation
Revision as of 15:26, 16 December 2011 by Tdb01r (Talk | contribs)

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.3, 3.2) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::MetaField - A single metadata field.

User Comments


SYNOPSIS

my $field = $dataset->field( $fieldname );

$dataset = $field->dataset;

$repo = $field->repository;

$field->set_property( $property, $value );

$value = $field->property( $property );

$name = $field->name;

$type = $field->type;

$xhtml = $field->render_name;

$xhtml = $field->render_help;

$xhtml = $field->render_value_label( $value );

$values = $field->all_values( %opts );

$sorted_list = $field->sort_values( $unsorted_list );


User Comments


DESCRIPTION

This object represents a single metadata field, not the value of that field. A field belongs (usually) to a dataset and has a large number of properties. Optional and required properties vary between types.

"type" is the most important property, it is the type of the metadata field. For example: "text", "name" or "date".

A full description of metadata types and properties is in the eprints documentation and will not be duplicated here.

User Comments


METHODS

User Comments


set_property

$field->set_property( $property, $value )

Set the named property to the given value.

This should not be called on metafields unless they've been cloned first.

This method will cause an abort error if the metafield is read only.

In these cases a cloned version of the field should be used.

User Comments


repository

$repository = $field->repository

Return the EPrints::Repository to which this field belongs.

User Comments


dataset

$dataset = $field->dataset

Return the EPrints::DataSet to which this field belongs, or undef.

User Comments


render_name

$xhtml = $field->render_name

Render the name of this field as an XHTML object.

User Comments


render_help

$xhtml = $field->render_help

Return the help information for a user inputing some data for this field as an XHTML chunk.

User Comments


name

$name = $field->name

Return the name of this field.

User Comments


type

$type = $field->type

Return the type of this field.

User Comments


property

$value = $field->property( $property )

Return the value of the given property.

Special note about "required" property: It only indicates if the field is always required. You must query the dataset to check if it is required for a specific type.

User Comments


sort_values

$out_list = $field->sort_values( $in_list, $langid )

Sorts the in_list into order, based on the "order values" of the values in the in_list. Assumes that the values are not a list of multiple values. [ [], [], [] ], but rather a list of single values.

User Comments


all_values

$values = $field->all_values( %opts )

Return a reference to an array of all the values of this field. For fields like "subject" or "set" it returns all the variations. For fields like "text" return all the distinct values from the database.

Results are sorted according to the ordervalues of the current session.

User Comments


COPYRIGHT

User Comments