function Views::getView

Same name in other branches
  1. 9 core/modules/views/src/Views.php \Drupal\views\Views::getView()
  2. 8.9.x core/modules/views/src/Views.php \Drupal\views\Views::getView()
  3. 10 core/modules/views/src/Views.php \Drupal\views\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.

465 calls to Views::getView()
AccessPermissionTest::testAccessPerm in core/modules/user/tests/src/Kernel/Views/AccessPermissionTest.php
Tests perm access plugin.
AccessPermissionTest::testRenderCaching in core/modules/user/tests/src/Kernel/Views/AccessPermissionTest.php
Tests access on render caching.
AccessRoleTest::testRenderCaching in core/modules/user/tests/src/Functional/Views/AccessRoleTest.php
Tests access on render caching.
AccessTest::testAccessNone in core/modules/views/tests/src/Functional/Plugin/AccessTest.php
Tests none access plugin.
AccessTest::testStaticAccessPlugin in core/modules/views/tests/src/Functional/Plugin/AccessTest.php
Tests static access check.

... 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.