all_element_texts — Get all element text metadata for a record.

View-related functions

Summary

all_element_texts($record, $options = array())

Get all element text metadata for a record.

Parameters:
  • $record (Omeka_Record_AbstractRecord|string) – The record to get the element text metadata for.
  • $options (array) – Options for getting the metadata.
Returns:

string|array

Usage

Valid keys for the $options array are:

  • show_empty_elements: Whether to include elements that have no values. If specified, this overrides the corresponding site setting. If a string is passed, empty elements will be displayed and the string will be used as the replacement text shown for the empty elements.
  • show_element_set_headings: Whether to show the headings naming each element set (e.g., “Dublin Core”). If specified this overrides the corresponding site setting.
  • show_element_sets: Array of names of element sets to show. If omitted, all sets are included (except totally empty sets when show_empty_elements is false).
  • return_type: What kind of output the function should return. Must be one of "html" or "array". HTML output is the default, and the usual use case. Array output, when selected here, returns the text data indexed by element set and element.
  • partial: Path to the view partial script used to create the HTML output. By default the path is 'common/record-metadata.php'.

Examples

Use the show_empty_elements option to override the site configurations, either always showing or always hiding the empty elements.

<?php echo all_element_texts('item', array('show_empty_elements' => true));?>

Use the show_empty_elements option to set the text for the empty elements. The text will only display if the “Show Empty Elements” is enabled in the site configurations.

<?php echo all_element_texts('item', array('show_empty_elements' => 'This data is not available.'));?>

Use the show_element_set_headings option to override the site configurations, either always showing or always hiding the names of the different element sets.

<?php echo all_element_texts('item', array('show_element_set_headings' => true));?>

Use the show_element_sets option to dictate which element sets to display. Available sets include ‘Item Type Metadata’ and those listed at '[your_Omeka_url]/admin/element-sets'

<?php echo all_element_texts('item', array('show_element_sets' => array('Dublin Core', 'Item Type Metadata'))); ?>

See Also