You are here

function views_rss_core_preprocess_item_author in Views RSS 8.2

Preprocess function for item <link> element.

1 string reference to 'views_rss_core_preprocess_item_author'
views_rss_core_views_rss_item_elements in modules/views_rss_core/views_rss_core.module
Implements hook_views_rss_item_elements().

File

modules/views_rss_core/views_rss_core.inc, line 486
Preprocess functions for Views RSS: Core Elements module.

Code

function views_rss_core_preprocess_item_author(&$variables) {

  // @TODO move this into hooks.
  if (empty($variables['elements'][0]['value'])) {
    return;
  }
  $authors = $variables['elements'][0]['value'];
  $authors = str_replace('Author', '', $authors);
  $author_array = explode(',', $authors);
  $elements = array();
  foreach ($author_array as $dc_created) {

    // Strip Role and everything after.
    $dc_created = preg_replace('/Role(.*)$/s', '', $dc_created);
    $elements[] = array(
      'key' => 'author',
      'value' => trim($dc_created),
    );

    // Just do one for now.
    break;
  }
  $variables['elements'] = $elements;
}