You are here

public function CommerceAutoSkuConfigTask::getDerivativeDefinitions in Commerce AutoSKU 8.2

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/Derivative/CommerceAutoSkuConfigTask.php, line 41

Class

CommerceAutoSkuConfigTask

Namespace

Drupal\commerce_autosku\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = array();
  foreach ($this->entityManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    if (!$entity_type
      ->hasLinkTemplate('auto-sku')) {
      continue;
    }
    $this->derivatives["{$entity_type_id}.auto_sku_tab"] = array(
      'route_name' => "entity.{$entity_type_id}.auto_sku",
      'title' => 'Automatic SKU',
      'base_route' => "entity.{$entity_type_id}.edit_form",
      'weight' => 100,
    );
  }
  foreach ($this->derivatives as &$entry) {
    $entry += $base_plugin_definition;
  }
  return $this->derivatives;
}