public function MessageSubscribeUiLocalTask::getDerivativeDefinitions in Message Subscribe 8
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
- message_subscribe_ui/
src/ Plugin/ Derivative/ MessageSubscribeUiLocalTask.php, line 44
Class
- MessageSubscribeUiLocalTask
- Provides local tasks for the message subscription UI.
Namespace
Drupal\message_subscribe_ui\Plugin\DerivativeCode
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;
}