class LocalActionsBlock
Same name in other branches
- 9 core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php \Drupal\Core\Menu\Plugin\Block\LocalActionsBlock
- 10 core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php \Drupal\Core\Menu\Plugin\Block\LocalActionsBlock
- 11.x core/lib/Drupal/Core/Menu/Plugin/Block/LocalActionsBlock.php \Drupal\Core\Menu\Plugin\Block\LocalActionsBlock
Provides a block to display the local actions.
Plugin annotation
@Block(
id = "local_actions_block",
admin_label = @Translation("Primary admin actions")
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Component\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\ContextAwarePluginInterface
- class \Drupal\Core\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\ContextAwarePluginBase implements \Drupal\Core\Plugin\ContextAwarePluginInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\TypedData\TypedDataTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Block\BlockBase extends \Drupal\Core\Plugin\ContextAwarePluginBase implements \Drupal\Core\Block\BlockPluginInterface, \Drupal\Core\Plugin\PluginWithFormsInterface, \Drupal\Core\Render\PreviewFallbackInterface uses \Drupal\Core\Block\BlockPluginTrait, \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait
- class \Drupal\Core\Menu\Plugin\Block\LocalActionsBlock extends \Drupal\Core\Block\BlockBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface
- class \Drupal\Core\Block\BlockBase extends \Drupal\Core\Plugin\ContextAwarePluginBase implements \Drupal\Core\Block\BlockPluginInterface, \Drupal\Core\Plugin\PluginWithFormsInterface, \Drupal\Core\Render\PreviewFallbackInterface uses \Drupal\Core\Block\BlockPluginTrait, \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait
- class \Drupal\Core\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\ContextAwarePluginBase implements \Drupal\Core\Plugin\ContextAwarePluginInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\TypedData\TypedDataTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Component\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\ContextAwarePluginInterface
Expanded class hierarchy of LocalActionsBlock
File
-
core/
lib/ Drupal/ Core/ Menu/ Plugin/ Block/ LocalActionsBlock.php, line 19
Namespace
Drupal\Core\Menu\Plugin\BlockView source
class LocalActionsBlock extends BlockBase implements ContainerFactoryPluginInterface {
/**
* The local action manager.
*
* @var \Drupal\Core\Menu\LocalActionManagerInterface
*/
protected $localActionManager;
/**
* The route match.
*
* @var \Drupal\Core\Routing\RouteMatchInterface
*/
protected $routeMatch;
/**
* Creates a LocalActionsBlock instance.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Menu\LocalActionManagerInterface $local_action_manager
* A local action manager.
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, LocalActionManagerInterface $local_action_manager, RouteMatchInterface $route_match) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->localActionManager = $local_action_manager;
$this->routeMatch = $route_match;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container->get('plugin.manager.menu.local_action'), $container->get('current_route_match'));
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [
'label_display' => FALSE,
];
}
/**
* {@inheritdoc}
*/
public function build() {
$route_name = $this->routeMatch
->getRouteName();
$local_actions = $this->localActionManager
->getActionsForRoute($route_name);
return $local_actions;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
LocalActionsBlock::$localActionManager | protected | property | The local action manager. | |
LocalActionsBlock::$routeMatch | protected | property | The route match. | |
LocalActionsBlock::build | public | function | ||
LocalActionsBlock::create | public static | function | Creates an instance of the plugin. | Overrides ContainerFactoryPluginInterface::create |
LocalActionsBlock::defaultConfiguration | public | function | ||
LocalActionsBlock::__construct | public | function | Creates a LocalActionsBlock instance. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.