Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Views.php

function Views::getView

Loads a view from configuration and returns its executable object.

Parameters

string $id: The view ID to load.

Return value

\Drupal\views\ViewExecutable|null A view executable instance or NULL if the view does not exist.

7 calls to Views::getView()
GroupwiseMax::leftQuery in core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
Generate a subquery given the user options, as set in the options.
View::preRenderViewElement in core/modules/views/src/Element/View.php
View element pre render callback.
ViewEditForm::save in core/modules/views_ui/src/ViewEditForm.php
Form submission handler for the 'save' action.
ViewPageController::getTitle in core/modules/views/src/Routing/ViewPageController.php
Gets the title of the given view's display.
ViewsSelection::initializeView in core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
Initializes a view.

... See full list

File

core/modules/views/src/Views.php, line 121

Class

Views
Static service container wrapper for views.

Namespace

Drupal\views

Code

public static function getView($id) {
    $view = \Drupal::entityTypeManager()->getStorage('view')
        ->load($id);
    if ($view) {
        return static::executableFactory()->get($view);
    }
    return NULL;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal