You are here

function View::render in Views (for Drupal 7) 8.3

Same name in this branch
  1. 8.3 lib/Views/comment/Plugin/views/row/View.php \Views\comment\Plugin\views\row\View::render()
  2. 8.3 lib/Views/search/Plugin/views/row/View.php \Views\search\Plugin\views\row\View::render()
  3. 8.3 lib/Drupal/views/Plugin/views/area/View.php \Drupal\views\Plugin\views\area\View::render()

Render the area

Overrides AreaPluginBase::render

File

lib/Drupal/views/Plugin/views/area/View.php, line 61
Definition of Drupal\views\Plugin\views\area\View.

Class

View
Views area handlers. Insert a view inside of an area.

Namespace

Drupal\views\Plugin\views\area

Code

function render($empty = FALSE) {
  if (!empty($this->options['view_to_insert'])) {
    list($view_name, $display_id) = explode(':', $this->options['view_to_insert']);
    $view = views_get_view($view_name);
    if (empty($view) || !$view
      ->access($display_id)) {
      return;
    }
    $view
      ->setDisplay($display_id);

    // Avoid recursion
    $view->parent_views += $this->view->parent_views;
    $view->parent_views[] = "{$view_name}:{$display_id}";

    // Check if the view is part of the parent views of this view
    $search = "{$view_name}:{$display_id}";
    if (in_array($search, $this->view->parent_views)) {
      drupal_set_message(t("Recursion detected in view @view display @display.", array(
        '@view' => $view_name,
        '@display' => $display_id,
      )), 'error');
    }
    else {
      if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) {
        return $view
          ->preview($display_id, $this->view->args);
      }
      else {
        return $view
          ->preview($display_id);
      }
    }
  }
  return '';
}