1 views_handler_area_view.inc protected views_handler_area_view::loadView()

Loads the used view for rendering.

Return value

\view|NULL: The loaded view or NULL, in case the view was not loadable / recursion got detected / access got denied.

File

core/modules/views/handlers/views_handler_area_view.inc, line 72
Definition of views_handler_area_view.

Class

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

Code

protected function loadView() {
  if (empty($this->options['view_to_insert'])) {
    return NULL;
  }
  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 NULL;
  }
  $view->set_display($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)) {
    backdrop_set_message(t("Recursion detected in view @view display @display.", array('@view' => $view_name, '@display' => $display_id)), 'error');
    return NULL;
  }

  return $view;
}