Returns the definition of all derivatives of a base plugin.
array $base_plugin_definition: The definition array of the base plugin.
array An array of full derivative definitions keyed on derivative id.
Overrides DerivativeInterface::getDerivativeDefinitions
getDerivativeDefinition()
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;
}