Omeka_View_Helper_Metadata

Package: View\Helper

class Omeka_View_Helper_Metadata

extends Zend_View_Helper_Abstract

Helper used to retrieve record metadata for for display.

Omeka_View_Helper_Metadata::metadata($record, $metadata, $options = array())

Retrieve a specific piece of a record’s metadata for display.

Parameters:
  • $record (Omeka_Record_AbstractRecord) – Database record representing the item from which to retrieve field data.

  • $metadata (string|array) – The metadata field to retrieve. If a string, refers to a property of the record itself. If an array, refers to an Element: the first entry is the set name, the second is the element name.

  • $options (array|string|int) – Options for formatting the metadata for display. - Array options: - ‘all’: If true, return an array containing all values for the field. - ‘delimiter’: Return the entire set of metadata as a string, where entries are separated by the given delimiter. - ‘index’: Return the metadata entry at the given zero-based index. - ‘no_escape’ => If true, do not escape the resulting values for HTML entities. - ‘no_filter’: If true, return the set of metadata without running any of the filters. - ‘snippet’: Trim the length of each piece of text to the given length in characters. - Passing simply the string ‘all’ is equivalent to array(‘all’ => true) - Passing simply an integer is equivalent to array(‘index’ => [the integer])

Returns:

string|array|null Null if field does not exist for item. Array if certain options are passed. String otherwise.

Omeka_View_Helper_Metadata::_getOptions($options)

Options can sometimes be an integer or a string instead of an array, which functions as a handy shortcut for theme writers. This converts the short form of the options into its proper array form.

Parameters:
  • $options (string|int|array) –

Returns:

array

Omeka_View_Helper_Metadata::_getText($record, $metadata)

Retrieve the text associated with a given element or field of the record.

Parameters:
Returns:

string|array Either an array of ElementText records or a string.

Omeka_View_Helper_Metadata::_getRecordMetadata($record, $specialValue)

Retrieve record metadata that is not stored as ElementTexts.

Parameters:
Returns:

mixed

Omeka_View_Helper_Metadata::_getElementText($record, $elementSetName, $elementName)

Retrieve the set of ElementText records that correspond to a given element set and element.

Parameters:
Returns:

array Set of ElementText records.

Omeka_View_Helper_Metadata::_process($record, $metadata, $text, $snippet, $escape, $filter)

Process an individual piece of text.

If given an ElementText record, the actual text string will be extracted automatically.

Parameters:
  • $record (Omeka_Record_AbstractRecord) –

  • $metadata (string|array) –

  • $text (string|ElementText) – Text to process.

  • $snippet (int|bool) – Snippet length, or false if no snippet.

  • $escape (bool) – Whether to HTML escape the text.

  • $filter (bool) – Whether to pass the output through plugin filters.

Returns:

string

Omeka_View_Helper_Metadata::_filterText($record, $metadata, $text, $elementText)

Apply filters to a text value.

Parameters:
Returns:

string