You are here

public function ViewsEntityRow::getDerivativeDefinitions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php \Drupal\views\Plugin\Derivative\ViewsEntityRow::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 DeriverInterface::getDerivativeDefinitions

See also

getDerivativeDefinition()

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

File

core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php, line 93
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($base_plugin_definition) {
  foreach ($this->entityManager
    ->getDefinitions() as $entity_type_id => $entity_type) {

    // Just add support for entity types which have a views integration.
    if (($base_table = $entity_type
      ->getBaseTable()) && $this->viewsData
      ->get($base_table) && $this->entityManager
      ->hasHandler($entity_type_id, 'view_builder')) {
      $this->derivatives[$entity_type_id] = array(
        'id' => 'entity:' . $entity_type_id,
        'provider' => 'views',
        'title' => $entity_type
          ->getLabel(),
        'help' => t('Display the @label', array(
          '@label' => $entity_type
            ->getLabel(),
        )),
        'base' => array(
          $entity_type
            ->getDataTable() ?: $entity_type
            ->getBaseTable(),
        ),
        'entity_type' => $entity_type_id,
        'display_types' => array(
          'normal',
        ),
        'class' => $base_plugin_definition['class'],
      );
    }
  }
  return $this->derivatives;
}