public function ViewsEntityRow::getDerivativeDefinitions

Returns 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 DerivativeInterface::getDerivativeDefinitions

See also

getDerivativeDefinition()

1 call to ViewsEntityRow::getDerivativeDefinitions()
ViewsEntityRow::getDerivativeDefinition in drupal/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsEntityRow.php
Returns the definition of a derivative plugin.

File

drupal/core/modules/views/lib/Drupal/views/Plugin/Derivative/ViewsEntityRow.php, line 43
Contains \Drupal\views\Plugin\Derivative\ViewsEntityRow.

Class

ViewsEntityRow
Provides views row plugin definitions for all non-special entity types.

Namespace

Drupal\views\Plugin\Derivative

Code

public function getDerivativeDefinitions(array $base_plugin_definition) {
  $entity_types = \Drupal::entityManager()
    ->getDefinitions();
  $views_data = Views::viewsData();
  foreach ($entity_types as $entity_type => $entity_info) {

    // Just add support for entity types which have a views integration.
    if (isset($entity_info['base_table']) && $views_data
      ->get($entity_info['base_table']) && \Drupal::entityManager()
      ->hasController($entity_type, 'render')) {
      $this->derivatives[$entity_type] = array(
        'id' => 'entity:' . $entity_type,
        'module' => 'views',
        'title' => $entity_info['label'],
        'help' => t('Display the @label', array(
          '@label' => $entity_info['label'],
        )),
        'base' => array(
          $entity_info['base_table'],
        ),
        'entity_type' => $entity_type,
        'display_types' => array(
          'normal',
        ),
        'class' => $base_plugin_definition['class'],
      );
    }
  }
  return $this->derivatives;
}