Omeka_View_Helper_Metadata

class Omeka_View_Helper_Metadata

Package: View\Helper

Helper used to retrieve record metadata for for display.

property _record
property _metadata
metadata(Omeka_Record_AbstractRecord $record, string|array $metadata, array|string|integer $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|integer) – 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.

_getOptions(string|integer|array $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|integer|array) –
Returns:

array

_getText(Omeka_Record_AbstractRecord $record, string|array $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.

_getRecordMetadata(Omeka_Record_AbstractRecord $record, string $specialValue)

Retrieve record metadata that is not stored as ElementTexts.

Parameters:
Returns:

mixed

_getElementText(Omeka_Record_AbstractRecord $record, string $elementSetName, string $elementName)

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

Parameters:
Returns:

array Set of ElementText records.

_process(string|ElementText $text, int|bool $snippet, bool $escape, bool $filter)

Process an individual piece of text.

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

Parameters:
  • $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

_filterText(string $text, ElementText|bool $elementText)

Apply filters to a text value.

Parameters:
  • $text (string) –
  • $elementText (ElementText|bool) –
Returns:

string