class PageActions

Provides the Page Actions basic top bar item.

Hierarchy

Expanded class hierarchy of PageActions

File

core/modules/navigation/src/Plugin/TopBarItem/PageActions.php, line 19

Namespace

Drupal\navigation\Plugin\TopBarItem
View source
final class PageActions extends TopBarItemBase implements ContainerFactoryPluginInterface {
    public function __construct(array $configuration, $plugin_id, $plugin_definition, NavigationRenderer $navigationRenderer) {
        parent::__construct($configuration, $plugin_id, $plugin_definition);
    }
    public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) : static {
        return new static($configuration, $plugin_id, $plugin_definition, $container->get(NavigationRenderer::class));
    }
    
    /**
     * {@inheritdoc}
     */
    public function build() : array {
        $build = [
            '#cache' => [
                'contexts' => [
                    'route',
                ],
            ],
        ];
        // Local tasks for content entities.
        if ($this->navigationRenderer
            ->hasLocalTasks()) {
            $local_tasks = $this->navigationRenderer
                ->getLocalTasks();
            $build += [
                '#theme' => 'top_bar_local_tasks',
                '#local_tasks' => $local_tasks['tasks'],
            ];
            assert($local_tasks['cacheability'] instanceof CacheableMetadata);
            $local_tasks['cacheability']->applyTo($build);
        }
        return $build;
    }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overriden Title
PageActions::build public function Builds and returns the renderable array for this top bar item plugin. Overrides TopBarItemBase::build
PageActions::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
PageActions::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct
PluginBase::$configuration protected property Configuration information passed into the plugin.
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin ID.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition
PluginBase::getPluginId public function Gets the plugin ID of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable Deprecated public function Determines if the plugin is configurable.
TopBarItemBase::label public function Returns the translated plugin label. Overrides TopBarItemPluginInterface::label
TopBarItemBase::region public function Returns the plugin region. Overrides TopBarItemPluginInterface::region

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.