You are here

public static function Views::getView in Drupal 9

Same name and namespace in other branches
  1. 8 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.

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