You are here

public function DefaultWizardDeriver::getDerivativeDefinitions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/Derivative/DefaultWizardDeriver.php \Drupal\views\Plugin\Derivative\DefaultWizardDeriver::getDerivativeDefinitions()
  2. 10 core/modules/views/src/Plugin/Derivative/DefaultWizardDeriver.php \Drupal\views\Plugin\Derivative\DefaultWizardDeriver::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

core/modules/views/src/Plugin/Derivative/DefaultWizardDeriver.php, line 18

Class

DefaultWizardDeriver
A derivative class which provides automatic wizards for all base tables.

Namespace

Drupal\views\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $views_data = Views::viewsData();
  $base_tables = array_keys($views_data
    ->fetchBaseTables());
  $this->derivatives = [];
  foreach ($base_tables as $table) {
    $views_info = $views_data
      ->get($table);
    if (empty($views_info['table']['wizard_id'])) {
      $this->derivatives[$table] = [
        'id' => 'standard',
        'base_table' => $table,
        'title' => $views_info['table']['base']['title'],
        'class' => 'Drupal\\views\\Plugin\\views\\wizard\\Standard',
      ];
    }
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}