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

411 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::testAccessRole in core/modules/user/tests/src/Functional/Views/AccessRoleTest.php
Tests role access plugin.
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.

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