You are here

class BlockContentAddLocalAction in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/block_content/src/Plugin/Menu/LocalAction/BlockContentAddLocalAction.php \Drupal\block_content\Plugin\Menu\LocalAction\BlockContentAddLocalAction
  2. 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

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\LocalAction
View 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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlockContentAddLocalAction::getOptions public function Returns options for rendering a link for the local action. Overrides LocalActionDefault::getOptions
DependencySerializationTrait::$_entityStorages protected property
DependencySerializationTrait::$_serviceIds protected property
DependencySerializationTrait::__sleep public function 2
DependencySerializationTrait::__wakeup public function 2
LocalActionDefault::$routeProvider protected property The route provider to load routes by name.
LocalActionDefault::create public static function
LocalActionDefault::getCacheContexts public function
LocalActionDefault::getCacheMaxAge public function
LocalActionDefault::getCacheTags public function
LocalActionDefault::getRouteName public function
LocalActionDefault::getRouteParameters public function
LocalActionDefault::getTitle public function
LocalActionDefault::getWeight public function
LocalActionDefault::__construct public function Constructs a LocalActionDefault object.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
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
PluginBase::getDerivativeId public function
PluginBase::getPluginDefinition public function 1
PluginBase::getPluginId public function
PluginBase::isConfigurable public function Determines if the plugin is configurable.