class BlockContentAddLocalAction in Drupal 10
Same name and namespace in other branches
- 8 core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction
- 9 core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction
Modifies the 'Add custom block' local action.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Menu\LocalActionDefault implements CacheableDependencyInterface, LocalActionInterface, ContainerFactoryPluginInterface uses DependencySerializationTrait
- class \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction
- class \Drupal\Core\Menu\LocalActionDefault implements CacheableDependencyInterface, LocalActionInterface, ContainerFactoryPluginInterface uses DependencySerializationTrait
Expanded class hierarchy of BlockContentAddLocalAction
1 string reference to 'BlockContentAddLocalAction'
- block_content.links.action.yml in core/
modules/ block_content/ block_content.links.action.yml - core/modules/block_content/block_content.links.action.yml
File
- core/
modules/ block_content/ src/ Plugin/ Menu/ LocalAction/ BlockContentAddLocalAction.php, line 12
Namespace
Drupal\block_content\Plugin\Menu\LocalActionView source
class BlockContentAddLocalAction extends LocalActionDefault {
/**
* {@inheritdoc}
*/
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;
}
}