function Views::getEnabledViews

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

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

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