You are here

public static function Views::getEnabledViews in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Views.php \Drupal\views\Views::getEnabledViews()
  2. 9 core/modules/views/src/Views.php \Drupal\views\Views::getEnabledViews()

Returns an array of all enabled views.

Return value

\Drupal\views\Entity\View[] An array of loaded enabled view entities.

2 calls to Views::getEnabledViews()
ModuleTest::testLoadFunctions in core/modules/views/tests/src/Kernel/ModuleTest.php
Tests the load wrapper/helper functions.
ViewsListTest::testViewsListLimit in core/modules/views_ui/tests/src/Functional/ViewsListTest.php
Tests that the views list does not use a pager.

File

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

Class

Views
Static service container wrapper for views.

Namespace

Drupal\views

Code

public static function getEnabledViews() {
  $query = \Drupal::entityQuery('view')
    ->condition('status', TRUE)
    ->execute();
  return \Drupal::entityTypeManager()
    ->getStorage('view')
    ->loadMultiple($query);
}