You are here

function template_preprocess_views_view_views_rss_field in Views RSS 6.2

Template preprocessor for views-view-views-rss-field.tpl.php.

File

theme/theme.inc, line 224
Theme functions for Views RSS module.

Code

function template_preprocess_views_view_views_rss_field(&$variables) {
  $element = $variables['element'];

  // Our CCK formatters could return value as a simple string - then we just
  // use it, or as serialized array (in cases when not only value needs to be
  // returned, by also additional arguments, subelements, or whatever else).
  // In such cases we need to unserialize obtained array and merge it back
  // into $variables array here.
  if (strpos($variables['value'], 'serialized:') !== FALSE) {
    $formatter_variables = unserialize(str_replace('serialized:', '', $variables['value']));
    $variables['value'] = NULL;
    $variables = array_merge($variables, $formatter_variables);
  }

  // Theme all subelements first (if any) and pass them to the template ready to use.
  if (!empty($variables['subelements'])) {
    foreach ($variables['subelements'] as $key => $subelement) {
      $subelement['view'] = $variables['view'];
      $subelement['item'] = $variables['item'];
      $variables['subelements'][$key] = views_rss_theme7('views_view_views_rss_field', $subelement);
    }
  }

  // Theme hook suggestions. Examples assume that:
  // - element = "title"
  // - display plugin = "feed"
  // - current display = "feed_1"
  // - view name = "myfeed"
  $base = 'views-view-views-rss-field--';

  // views-view-views-rss-field--views-view-field--title.tpl.php
  $variables['template_files'][] = $base . $element;

  // views-view-views-rss-field--views-view-field--myfeed.tpl.php
  $variables['template_files'][] = $base . $variables['view']->name;

  // views-view-views-rss-field--views-view-field--myfeed--title.tpl.php
  $variables['template_files'][] = $base . $variables['view']->name . '--' . $element;

  // views-view-views-rss-field--views-view-field--feed.tpl.php
  $variables['template_files'][] = $base . $variables['view']->display[$variables['view']->current_display]->display_plugin;

  // views-view-views-rss-field--views-view-field--feed--title.tpl.php
  $variables['template_files'][] = $base . $variables['view']->display[$variables['view']->current_display]->display_plugin . '--' . $element;

  // views-view-views-rss-field--views-view-field--myfeed--feed.tpl.php
  $variables['template_files'][] = $base . $variables['view']->name;

  // views-view-views-rss-field--views-view-field--myfeed--feed.tpl.php
  $variables['template_files'][] = $base . $variables['view']->name . '--' . $variables['view']->display[$variables['view']->current_display]->display_plugin;

  // views-view-views-rss-field--views-view-field--feed-1.tpl.php
  $variables['template_files'][] = $base . $variables['view']->current_display;

  // views-view-views-rss-field--views-view-field--feed-1--title.tpl.php
  $variables['template_files'][] = $base . $variables['view']->current_display . '--' . $element;

  // views-view-views-rss-field--views-view-field--myfeed--feed-1.tpl.php
  $variables['template_files'][] = $base . $variables['view']->name . '--' . $variables['view']->current_display;

  // views-view-views-rss-field--views-view-field--myfeed--feed-1--title.tpl.php
  $variables['template_files'][] = $base . $variables['view']->name . '--' . $variables['view']->current_display . '--' . $element;
}