You are here

public function DsEntityRow::getDerivativeDefinitions in Display Suite 8.3

Same name and namespace in other branches
  1. 8.4 src/Plugin/Derivative/DsEntityRow.php \Drupal\ds\Plugin\Derivative\DsEntityRow::getDerivativeDefinitions()
  2. 8.2 src/Plugin/Derivative/DsEntityRow.php \Drupal\ds\Plugin\Derivative\DsEntityRow::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 DsEntityRow::getDerivativeDefinitions()
DsEntityRow::getDerivativeDefinition in src/Plugin/Derivative/DsEntityRow.php
Gets the definition of a derivative plugin.

File

src/Plugin/Derivative/DsEntityRow.php, line 88

Class

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

Namespace

Drupal\ds\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  foreach ($this->entityTypeManager
    ->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->entityTypeManager
      ->hasHandler($entity_type_id, 'view_builder')) {
      $this->derivatives[$entity_type_id] = [
        'id' => 'ds_entity:' . $entity_type_id,
        'provider' => 'ds',
        'title' => 'Display Suite: ' . $entity_type
          ->getLabel(),
        'help' => t('Display the @label', [
          '@label' => $entity_type
            ->getLabel(),
        ]),
        'base' => [
          $entity_type
            ->getDataTable() ?: $entity_type
            ->getBaseTable(),
        ],
        'entity_type' => $entity_type_id,
        'display_types' => [
          'normal',
        ],
        'class' => $base_plugin_definition['class'],
      ];
    }
  }
  return $this->derivatives;
}