You are here

public function BreakLockDeriver::getDerivativeDefinitions in Content locking (anti-concurrent editing) 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Action/BreakLockDeriver.php \Drupal\content_lock\Plugin\Action\BreakLockDeriver::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 DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/Action/BreakLockDeriver.php, line 56

Class

BreakLockDeriver
Provides an action deriver that finds content entity types.

Namespace

Drupal\content_lock\Plugin\Action

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'] = sprintf('%s %s', $base_plugin_definition['action_label'], $entity_type
        ->getSingularLabel());
      $definitions[$entity_type_id] = $definition;
    }
    $this->derivatives = $definitions;
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}