Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BlockContentAddLocalAction.php

class BlockContentAddLocalAction

Modifies the 'Add content block' local action.

Hierarchy

  • class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
    • class \Drupal\Core\Menu\LocalActionDefault extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Core\Menu\LocalActionInterface, \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait
      • class \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction extends \Drupal\Core\Menu\LocalActionDefault

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 15

Namespace

Drupal\block_content\Plugin\Menu\LocalAction
View source
class BlockContentAddLocalAction extends LocalActionDefault {
    
    /**
     * Constructs a BlockContentAddLocalAction object.
     */
    public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteProviderInterface $routeProvider, RequestStack $requestStack) {
        parent::__construct($configuration, $plugin_id, $plugin_definition, $routeProvider);
    }
    
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
        return new static($configuration, $plugin_id, $plugin_definition, $container->get('router.route_provider'), $container->get('request_stack'));
    }
    
    /**
     * {@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;
        }
        // If the current request has a region, append it to the query string.
        if ($region = $this->requestStack
            ->getCurrentRequest()->query
            ->getString('region')) {
            $options['query']['region'] = $region;
        }
        // Adds a destination on content block listing.
        if ($route_match->getRouteName() == 'entity.block_content.collection') {
            $options['query']['destination'] = Url::fromRoute('<current>')->toString();
        }
        return $options;
    }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overriden Title Overrides
BlockContentAddLocalAction::create public static function Creates an instance of the plugin. Overrides LocalActionDefault::create
BlockContentAddLocalAction::getOptions public function Returns options for rendering a link for the local action. Overrides LocalActionDefault::getOptions
BlockContentAddLocalAction::__construct public function Constructs a BlockContentAddLocalAction object. Overrides LocalActionDefault::__construct
DependencySerializationTrait::$_entityStorages protected property
DependencySerializationTrait::$_serviceIds protected property
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
LocalActionDefault::$routeProvider protected property The route provider to load routes by name.
LocalActionDefault::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts
LocalActionDefault::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge
LocalActionDefault::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyInterface::getCacheTags
LocalActionDefault::getRouteName public function Get the route name from the settings. Overrides LocalActionInterface::getRouteName
LocalActionDefault::getRouteParameters public function Returns the route parameters needed to render a link for the local action. Overrides LocalActionInterface::getRouteParameters
LocalActionDefault::getTitle public function Returns the localized title to be shown for this action. Overrides LocalActionInterface::getTitle
LocalActionDefault::getWeight public function Returns the weight for the local action. Overrides LocalActionInterface::getWeight
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.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal