You are here

function theme_views_oai_pmh_row_dc_fields in Views OAI-PMH 7

Same name and namespace in other branches
  1. 6 theme/views_oai_pmh.theme.inc \theme_views_oai_pmh_row_dc_fields()

@file Theme related functions for processing our output style plugins.

Views bug: http://drupal.org/node/593336

File

theme/views_oai_pmh.theme.inc, line 12
Theme related functions for processing our output style plugins.

Code

function theme_views_oai_pmh_row_dc_fields($vars) {
  $view = $vars['view'];

  // Loop through the fields for this view.
  $previous_inline = FALSE;
  $vars['fields'] = array();

  // ensure it's at least an empty array.
  $row_index = $view->row_index;
  foreach ($view->field as $id => $field) {

    // render this even if set to exclude so it can be used elsewhere.
    $field_output = $view->style_plugin
      ->get_field($row_index, $id);
    $empty = $field_output !== 0 && empty($field_output);
    if (empty($field->options['exclude']) && (!$empty || empty($field->options['hide_empty']) && empty($vars['options']['hide_empty']))) {
      $key = check_plain(_views_oai_pmh_xml_tag_clean($view->field[$id]
        ->label()));
      if (isset($field->multiple) && !empty($field->multiple)) {
        $separator = $field->options['separator'];
        foreach (explode($separator, $field_output) as $value) {
          $item['key'] = $key;
          $item['value'] = _views_oai_pmh_xmlstr($value);
          $items[] = $item;
        }
      }
      else {
        $item['key'] = $key;
        $item['value'] = _views_oai_pmh_xmlstr($field_output);
        $items[] = $item;
      }
    }
  }
  return format_xml_elements($items);
}