You are here

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

Get the mapping for a field.

Return value

array An array where the first value is either a element path, or an attribute name the field is mapped to, and the second value a boolean that is TRUE if the first value is an attribute (not root attribute), FALSE otherwise.

1 call to views_oai_pmh_plugin_style::get_mapping()
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 878
Contains the base OAI-PMH style plugin.

Class

views_oai_pmh_plugin_style
Views OAI-PMH_plugin style.

Code

protected function get_mapping($field_name) {
  if (isset($this->options['field_mappings'][$this->request->metadata_format->id][$field_name])) {
    $mapping = $this->options['field_mappings'][$this->request->metadata_format->id][$field_name];
    if ($mapping != 'none' && $mapping[0] != '_') {
      if ($mapping[0] == '@') {

        // Mapping is an attribute.
        return array(
          substr($mapping, 1),
          TRUE,
        );
      }

      // Mapping is an element.
      return array(
        $mapping,
        FALSE,
      );
    }
  }
  return array(
    '',
    FALSE,
  );
}