Functions/show file metadata

Description

The show_file_metadata() helper inserts all the metadata field available for an file in an Omeka archive.

Usage

<?php echo show_file_metadata($options = array(), $file = null); ?>

Arguments

  • $options (array) - Three options are available:
    • show_empty_elements - (bool|string). Setting to false will prevent empty fields from being displayed. Setting to a text string will display empty fields, and display the string entered.
    • show_element_sets (array) - An array of element sets (by name) to display.
    • return_type - array or html. Default is html.
  • $file - File object or null (default). If null, the current file in the loop is used.

Examples

Hide Empty Elements

Set to "true" by default, the show_empty_elements option allows you to limit the fields displayed to all fields or to non-empty fields for an file. Setting this to "false" will only display fields that have data.

<?php 
 
echo show_file_metadata(array('show_empty_elements' => false)); 
 
?>

Change the Element String

If you'd like to change the text displayed for empty fields, pass the use the text of the string for the show_empty_elements option. Example:

<?php 
 
echo show_file_metadata(array('show_empty_elements' => 'Empty')); 
 
?>

This will display "Empty" instead of "[no text]" in your public theme.