diff --git a/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php b/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php
index 6e65758..a8b01a3 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/Core/Entity/View.php
@@ -289,26 +289,6 @@ public function &getDisplay($display_id) {
}
/**
- * Gets a list of displays included in the view.
- *
- * @return array
- * An array of display types that this view includes.
- */
- function getDisplaysList() {
- $manager = Views::pluginManager('display');
- $displays = array();
- foreach ($this->display as $display) {
- $definition = $manager->getDefinition($display['display_plugin']);
- if (!empty($definition['admin'])) {
- $displays[$definition['admin']] = TRUE;
- }
- }
-
- ksort($displays);
- return array_keys($displays);
- }
-
- /**
* Gets a list of paths assigned to the view.
*
* @return array
diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php
index 6a86adf..97ec65d 100644
--- a/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php
+++ b/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php
@@ -219,8 +219,6 @@ protected function displayMethodTests() {
);
$view = $this->controller->create($config);
- $this->assertEqual($view->getDisplaysList(), array('Feed', 'Page'), 'Make sure the display admin names are returns in alphabetic order.');
-
// Paths with a "%" shouldn't not be linked
$expected_paths = array();
$expected_paths[] = l('/test', 'test');
diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php
index 7bb130e..dcb6273 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php
@@ -7,13 +7,55 @@
namespace Drupal\views_ui;
+use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Config\Entity\ConfigEntityListController;
+use Drupal\Core\Entity\EntityControllerInterface;
+use Drupal\Core\Entity\EntityStorageControllerInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a listing of Views.
*/
-class ViewListController extends ConfigEntityListController {
+class ViewListController extends ConfigEntityListController implements EntityControllerInterface {
+
+ /**
+ * The views display plugin manager to use.
+ *
+ * @var \Drupal\Component\Plugin\PluginManagerInterface
+ */
+ protected $displayManager;
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info) {
+ return new static(
+ $entity_type,
+ $container->get('plugin.manager.entity')->getStorageController($entity_type),
+ $entity_info,
+ $container->get('plugin.manager.views.display')
+ );
+ }
+
+ /**
+ * Constructs a new EntityListController object.
+ *
+ * @param string $entity_type.
+ * The type of entity to be listed.
+ * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage.
+ * The entity storage controller class.
+ * @param array $entity_info
+ * An array of entity info for this entity type.
+ * @param \Drupal\Component\Plugin\PluginManagerInterface $display_manager
+ * The views display plugin manager to use.
+ */
+ public function __construct($entity_type, EntityStorageControllerInterface $storage, $entity_info, PluginManagerInterface $display_manager) {
+ $this->entityType = $entity_type;
+ $this->storage = $storage;
+ $this->entityInfo = $entity_info;
+ $this->displayManager = $display_manager;
+ }
/**
* Overrides Drupal\Core\Entity\EntityListController::load();
@@ -40,7 +82,7 @@ public function load() {
public function buildRow(EntityInterface $view) {
return array(
'data' => array(
- 'view_name' => theme('views_ui_view_info', array('view' => $view)),
+ 'view_name' => theme('views_ui_view_info', array('view' => $view, 'displays' => $this->getDisplaysList($view))),
'description' => $view->get('description'),
'tag' => $view->get('tag'),
'path' => implode(', ', $view->getPaths()),
@@ -156,4 +198,26 @@ public function render() {
return $list;
}
+ /**
+ * Gets a list of displays included in the view.
+ *
+ * @param \Drupal\Core\Entity\EntityInterface $view
+ * The view entity instance to get a list of displays for.
+ *
+ * @return array
+ * An array of display types that this view includes.
+ */
+ protected function getDisplaysList(EntityInterface $view) {
+ $displays = array();
+ foreach ($view->get('display') as $display) {
+ $definition = $this->displayManager->getDefinition($display['display_plugin']);
+ if (!empty($definition['admin'])) {
+ $displays[$definition['admin']] = TRUE;
+ }
+ }
+
+ ksort($displays);
+ return array_keys($displays);
+ }
+
}
diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module
index 21fdabe..343627e 100644
--- a/core/modules/views_ui/views_ui.module
+++ b/core/modules/views_ui/views_ui.module
@@ -154,7 +154,7 @@ function views_ui_theme() {
// list views
'views_ui_view_info' => array(
- 'variables' => array('view' => NULL, 'base' => NULL),
+ 'variables' => array('view' => NULL, 'displays' => NULL),
'file' => 'views_ui.theme.inc',
),
diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc
index 1980149..8e503fc 100644
--- a/core/modules/views_ui/views_ui.theme.inc
+++ b/core/modules/views_ui/views_ui.theme.inc
@@ -93,9 +93,7 @@ function template_preprocess_views_ui_display_tab_bucket(&$variables) {
*/
function template_preprocess_views_ui_view_info(&$variables) {
$variables['title'] = $variables['view']->label();
-
- $displays = $variables['view']->getDisplaysList();
- $variables['displays'] = empty($displays) ? t('None') : format_plural(count($displays), 'Display', 'Displays') . ': ' . '' . implode(', ', $displays) . '';
+ $variables['displays'] = empty($variables['displays']) ? t('None') : format_plural(count($variables['displays']), 'Display', 'Displays') . ': ' . '' . implode(', ', $variables['displays']) . '';
}
/**