function BlockContentAddLocalAction::getOptions
Same name in other branches
- 8.9.x core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction::getOptions()
- 10 core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction::getOptions()
- 11.x core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction::getOptions()
Overrides LocalActionDefault::getOptions
File
-
core/
modules/ block_content/ src/ Plugin/ Menu/ LocalAction/ BlockContentAddLocalAction.php, line 17
Class
- BlockContentAddLocalAction
- Modifies the 'Add custom block' local action.
Namespace
Drupal\block_content\Plugin\Menu\LocalActionCode
public function getOptions(RouteMatchInterface $route_match) {
$options = parent::getOptions($route_match);
// If the route specifies a theme, append it to the query string.
if ($theme = $route_match->getParameter('theme')) {
$options['query']['theme'] = $theme;
}
// Adds a destination on custom block listing.
if ($route_match->getRouteName() == 'entity.block_content.collection') {
$options['query']['destination'] = Url::fromRoute('<current>')->toString();
}
return $options;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.