You are here

public function SalesforceMappingLocalTask::getDerivativeDefinitions in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 modules/salesforce_mapping_ui/src/Plugin/Derivative/SalesforceMappingLocalTask.php \Drupal\salesforce_mapping_ui\Plugin\Derivative\SalesforceMappingLocalTask::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

modules/salesforce_mapping_ui/src/Plugin/Derivative/SalesforceMappingLocalTask.php, line 52

Class

SalesforceMappingLocalTask
Provides local task definitions for all entity bundles.

Namespace

Drupal\salesforce_mapping_ui\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = [];
  foreach ($this->etm
    ->getDefinitions() as $entity_type_id => $entity_type) {
    if (!($has_canonical_path = $entity_type
      ->hasLinkTemplate('salesforce'))) {
      continue;
    }
    $this->derivatives["{$entity_type_id}.salesforce_tab"] = [
      'route_name' => "entity.{$entity_type_id}.salesforce",
      'title' => $this
        ->t('Salesforce'),
      'base_route' => "entity.{$entity_type_id}.canonical",
      'weight' => 200,
    ] + $base_plugin_definition;
    $this->derivatives["{$entity_type_id}.salesforce"] = [
      'route_name' => "entity.{$entity_type_id}.salesforce",
      'weight' => 200,
      'title' => $this
        ->t('View'),
      'parent_id' => "salesforce_mapping.entities:{$entity_type_id}.salesforce_tab",
    ] + $base_plugin_definition;
  }
  return $this->derivatives;
}