You are here

public function ViewsUIController::reportPlugins in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/Controller/ViewsUIController.php \Drupal\views_ui\Controller\ViewsUIController::reportPlugins()

Lists all plugins and what enabled Views use them.

Return value

array The Views plugins report page.

1 string reference to 'ViewsUIController::reportPlugins'
views_ui.routing.yml in core/modules/views_ui/views_ui.routing.yml
core/modules/views_ui/views_ui.routing.yml

File

core/modules/views_ui/src/Controller/ViewsUIController.php, line 121
Contains \Drupal\views_ui\Controller\ViewsUIController.

Class

ViewsUIController
Returns responses for Views UI routes.

Namespace

Drupal\views_ui\Controller

Code

public function reportPlugins() {
  $rows = Views::pluginList();
  foreach ($rows as &$row) {
    $views = [];

    // Link each view name to the view itself.
    foreach ($row['views'] as $row_name => $view) {
      $views[] = $this
        ->l($view, new Url('entity.view.edit_form', array(
        'view' => $view,
      )));
    }
    unset($row['views']);
    $row['views']['data'] = [
      '#theme' => 'item_list',
      '#items' => $views,
      '#context' => [
        'list_style' => 'comma-list',
      ],
    ];
  }

  // Sort rows by field name.
  ksort($rows);
  return array(
    '#type' => 'table',
    '#header' => array(
      t('Type'),
      t('Name'),
      t('Provided by'),
      t('Used in'),
    ),
    '#rows' => $rows,
    '#empty' => t('There are no enabled views.'),
  );
}