views_views_pre_render

views_views_pre_render($view)

Implements hook_views_pre_render().

File

core/modules/views/views.module, line 53
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_views_pre_render($view) {
  // If using AJAX, send identifying data about this view.
  if ($view->ajaxEnabled() && empty($view->is_attachment) && empty($view->live_preview)) {
    $view->element['#attached']['drupalSettings']['views'] = array(
      'ajax_path' => \Drupal::url('views.ajax'),
      'ajaxViews' => array(
        'views_dom_id:' . $view->dom_id => array(
          'view_name' => $view->storage->id(),
          'view_display_id' => $view->current_display,
          'view_args' => Html::escape(implode('/', $view->args)),
          'view_path' => Html::escape(Url::fromRoute('<current>')->toString()),
          'view_base_path' => $view->getPath(),
          'view_dom_id' => $view->dom_id,
          // To fit multiple views on a page, the programmer may have
          // overridden the display's pager_element.
          'pager_element' => isset($view->pager) ? $view->pager->getPagerId() : 0,
        ),
      ),
    );
    $view->element['#attached']['library'][] = 'views/views.ajax';
  }

  return $view;
}
doc_Drupal
2016-10-29 09:55:44
Comments
Leave a Comment

Please login to continue.