public function SelectionBase::getDerivativeDefinitions

Implements DerivativeInterface::getDerivativeDefinitions().

Overrides DerivativeInterface::getDerivativeDefinitions

1 call to SelectionBase::getDerivativeDefinitions()
SelectionBase::getDerivativeDefinition in drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Derivative/SelectionBase.php
Implements DerivativeInterface::getDerivativeDefinition().

File

drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Derivative/SelectionBase.php, line 38
Contains \Drupal\entity_reference\Plugin\Derivative\SelectionBase.

Class

SelectionBase
Base class for selection plugins provided by Entity Reference.

Namespace

Drupal\entity_reference\Plugin\Derivative

Code

public function getDerivativeDefinitions(array $base_plugin_definition) {
  $supported_entities = array(
    'comment',
    'file',
    'node',
    'taxonomy_term',
    'user',
  );
  foreach (entity_get_info() as $entity_type => $info) {
    if (!in_array($entity_type, $supported_entities)) {
      $this->derivatives[$entity_type] = $base_plugin_definition;
      $this->derivatives[$entity_type]['label'] = t('@enitty_type selection', array(
        '@entity_type' => $info['label'],
      ));
    }
  }
  return $this->derivatives;
}