comparison core/modules/views/src/Plugin/Derivative/DefaultWizardDeriver.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 129ea1e6d783
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\views\Plugin\Derivative;
4
5 use Drupal\Component\Plugin\Derivative\DeriverBase;
6 use Drupal\views\Views;
7
8 /**
9 * A derivative class which provides automatic wizards for all base tables.
10 *
11 * The derivatives store all base table plugin information.
12 */
13 class DefaultWizardDeriver extends DeriverBase {
14 /**
15 * {@inheritdoc}
16 */
17 public function getDerivativeDefinitions($base_plugin_definition) {
18 $views_data = Views::viewsData();
19 $base_tables = array_keys($views_data->fetchBaseTables());
20 $this->derivatives = [];
21 foreach ($base_tables as $table) {
22 $views_info = $views_data->get($table);
23 if (empty($views_info['table']['wizard_id'])) {
24 $this->derivatives[$table] = [
25 'id' => 'standard',
26 'base_table' => $table,
27 'title' => $views_info['table']['base']['title'],
28 'class' => 'Drupal\views\Plugin\views\wizard\Standard'
29 ];
30 }
31 }
32 return parent::getDerivativeDefinitions($base_plugin_definition);
33 }
34
35 }