class RedhenConnectionLocalTask in RedHen CRM 8
Provides local task definitions for all entity bundles.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\redhen_connection\Plugin\Derivative\RedhenConnectionLocalTask implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of RedhenConnectionLocalTask
1 string reference to 'RedhenConnectionLocalTask'
- redhen_connection.links.task.yml in modules/
redhen_connection/ redhen_connection.links.task.yml - modules/redhen_connection/redhen_connection.links.task.yml
File
- modules/
redhen_connection/ src/ Plugin/ Derivative/ RedhenConnectionLocalTask.php, line 17
Namespace
Drupal\redhen_connection\Plugin\DerivativeView source
class RedhenConnectionLocalTask extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $service;
/**
* Creates an SalesforceMappingLocalTask object.
*
* @param ConnectionService $service
* The service manager.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The translation manager.
*/
public function __construct(ConnectionService $service, TranslationInterface $string_translation) {
$this->service = $service;
$this->stringTranslation = $string_translation;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('redhen_connection.connections'), $container
->get('string_translation'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
foreach ($this->service
->getAllConnectionEntityTypes() as $entity_type_id => $entity_type) {
if (!$entity_type
->hasLinkTemplate('redhen_connection')) {
continue;
}
$this->derivatives["{$entity_type_id}.redhen_connection_tab"] = [
'route_name' => "entity.{$entity_type_id}.redhen_connection",
'title' => $this
->t('Connections'),
'base_route' => "entity.{$entity_type_id}.canonical",
'weight' => 20,
] + $base_plugin_definition;
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
RedhenConnectionLocalTask:: |
protected | property | The entity manager. | |
RedhenConnectionLocalTask:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
RedhenConnectionLocalTask:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
RedhenConnectionLocalTask:: |
public | function | Creates an SalesforceMappingLocalTask object. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |