function template_preprocess_views_view_opml

Same name in other branches
  1. 9 core/modules/views/views.theme.inc \template_preprocess_views_view_opml()
  2. 8.9.x core/modules/views/views.theme.inc \template_preprocess_views_view_opml()
  3. 11.x core/modules/views/views.theme.inc \template_preprocess_views_view_opml()

Prepares variables for OPML feed templates.

Default template: views-view-opml.html.twig.

Parameters

array $variables: An associative array containing:

  • view: A ViewExecutable object.
  • rows: The raw row data.

File

core/modules/views/views.theme.inc, line 974

Code

function template_preprocess_views_view_opml(&$variables) {
    $view = $variables['view'];
    $items = $variables['rows'];
    $config = \Drupal::config('system.site');
    if ($view->display_handler
        ->getOption('sitename_title')) {
        $title = $config->get('name');
        if ($slogan = $config->get('slogan')) {
            $title .= ' - ' . $slogan;
        }
    }
    else {
        $title = $view->getTitle();
    }
    $variables['title'] = $title;
    $variables['items'] = $items;
    $variables['updated'] = gmdate(DATE_RFC2822, \Drupal::time()->getRequestTime());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.