You are here

public function EntityKmlDeriver::getDerivativeDefinitions in farmOS 2.x

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 EntityActionDeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

modules/core/kml/src/Plugin/Action/Derivative/EntityKmlDeriver.php, line 18

Class

EntityKmlDeriver
Provides an action deriver for the KML action.

Namespace

Drupal\farm_kml\Plugin\Action\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  if (empty($this->derivatives)) {
    $definitions = [];
    foreach ($this
      ->getApplicableEntityTypes() as $entity_type_id => $entity_type) {
      $definition = $base_plugin_definition;
      $definition['type'] = $entity_type_id;
      $definition['label'] = $this
        ->t('Export @entity_type KML', [
        '@entity_type' => $entity_type
          ->getSingularLabel(),
      ]);
      $definitions[$entity_type_id] = $definition;
    }
    $this->derivatives = $definitions;
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}