function 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.

1 call to views_handler_area_view::loadView()
views_handler_area_view::render in handlers/views_handler_area_view.inc
Render the area.

File

handlers/views_handler_area_view.inc, line 74

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)) {
        drupal_set_message(t("Recursion detected in view @view display @display.", array(
            '@view' => $view_name,
            '@display' => $display_id,
        )), 'error');
        return NULL;
    }
    return $view;
}