class MessageSubscribeUiLocalTask in Message Subscribe 8
Provides local tasks for the message subscription UI.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\message_subscribe_ui\Plugin\Derivative\MessageSubscribeUiLocalTask implements ContainerDeriverInterface
Expanded class hierarchy of MessageSubscribeUiLocalTask
1 string reference to 'MessageSubscribeUiLocalTask'
- message_subscribe_ui.links.task.yml in message_subscribe_ui/
message_subscribe_ui.links.task.yml - message_subscribe_ui/message_subscribe_ui.links.task.yml
File
- message_subscribe_ui/
src/ Plugin/ Derivative/ MessageSubscribeUiLocalTask.php, line 13
Namespace
Drupal\message_subscribe_ui\Plugin\DerivativeView source
class MessageSubscribeUiLocalTask extends DeriverBase implements ContainerDeriverInterface {
/**
* The message subscription service.
*
* @var \Drupal\message_subscribe\SubscribersInterface
*/
protected $subscribers;
/**
* Constructs the local task deriver.
*
* @param \Drupal\message_subscribe\SubscribersInterface $subscribers
* The message subscription service.
*/
public function __construct(SubscribersInterface $subscribers) {
$this->subscribers = $subscribers;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('message_subscribe.subscribers'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
$first = TRUE;
foreach ($this->subscribers
->getFlags() as $flag) {
$this->derivatives[$flag
->id()] = [
'title' => $flag
->label(),
// First route gets the same route name as the parent (in order to
// provide the default tab).
'route_name' => $first ? 'message_subscribe_ui.tab' : 'message_subscribe_ui.tab.flag',
'parent_id' => 'message_subscribe_ui.tab',
'route_parameters' => $first ? [] : [
'flag' => $flag
->id(),
],
];
$first = FALSE;
}
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:: |
|
MessageSubscribeUiLocalTask:: |
protected | property | The message subscription service. | |
MessageSubscribeUiLocalTask:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
MessageSubscribeUiLocalTask:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
MessageSubscribeUiLocalTask:: |
public | function | Constructs the local task deriver. |