You are here

protected function views_oai_pmh_plugin_style::get_root_attribute_elements in Views OAI-PMH 7.3

Get the values for the root attribute elements.

Return value

array An array with root attribute elements keyed by his name.

1 call to views_oai_pmh_plugin_style::get_root_attribute_elements()
views_oai_pmh_plugin_style::append_record_metadata in plugins/views_oai_pmh_plugin_style.inc
Builds the core of a record's XML.

File

plugins/views_oai_pmh_plugin_style.inc, line 853
Contains the base OAI-PMH style plugin.

Class

views_oai_pmh_plugin_style
Views OAI-PMH_plugin style.

Code

protected function get_root_attribute_elements($row_index, $fields) {
  $root_attributes = array();
  foreach ($fields as $field_name => $field) {
    $attribute_field = $this->view->field[$field_name];
    $attribute_value = $this
      ->get_field($row_index, $field_name);
    if (isset($this->options['field_mappings'][$this->request->metadata_format->id][$field_name]) && (!$attribute_field->options['hide_empty'] || !empty($attribute_value))) {
      $mapping = $this->options['field_mappings'][$this->request->metadata_format->id][$field_name];
      if ($mapping != 'none' && $mapping[0] == '_') {
        $root_attributes[substr($mapping, 1)] = $this
          ->get_field($row_index, $field_name);
      }
    }
  }
  return $root_attributes;
}