You are here

public static function Views::getEnabledViews in Drupal 8

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

3 calls to Views::getEnabledViews()
ModuleTest::testLoadFunctions in core/modules/views/tests/src/Kernel/ModuleTest.php
Tests the load wrapper/helper functions.
Views::pluginList in core/modules/views/src/Views.php
Returns a list of plugins and metadata about them.
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 255

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