class ConfigAction

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Config/Action/Attribute/ConfigAction.php \Drupal\Core\Config\Action\Attribute\ConfigAction

Defines a ConfigAction attribute object.

Plugin Namespace: Plugin\ConfigAction

@internal This API is experimental.

Attributes

#[\Attribute(\Attribute::TARGET_CLASS)]

Hierarchy

  • class \Drupal\Core\Config\Action\Attribute\ConfigAction implements \Drupal\Component\Plugin\Attribute\Plugin

Expanded class hierarchy of ConfigAction

See also

\Drupal\Core\Config\Action\ConfigActionPluginInterface

\Drupal\Core\Config\Action\ConfigActionManager

Plugin API

Related topics

10 files declare their use of ConfigAction
AddItemToToolbar.php in core/modules/ckeditor5/src/Plugin/ConfigAction/AddItemToToolbar.php
AddModeration.php in core/modules/content_moderation/src/Plugin/ConfigAction/AddModeration.php
AddToAllBundles.php in core/modules/field/src/Plugin/ConfigAction/AddToAllBundles.php
ConfigActionAttributeTest.php in core/tests/Drupal/Tests/Core/Config/Action/ConfigActionAttributeTest.php
ConfigActionManager.php in core/lib/Drupal/Core/Config/Action/ConfigActionManager.php

... See full list

File

core/lib/Drupal/Core/Config/Action/Attribute/ConfigAction.php, line 25

Namespace

Drupal\Core\Config\Action\Attribute
View source
final class ConfigAction extends Plugin {
  
  /**
   * Constructs a ConfigAction attribute.
   *
   * @param string $id
   *   The plugin ID.
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $admin_label
   *   The administrative label of the config action. This is optional when
   *   using a deriver, but in that case the deriver should add an admin label.
   * @param string[] $entity_types
   *   (optional) Allows action shorthand IDs for the listed config entity
   *   types. If '*' is present in the array then it can apply to all entity
   *   types. An empty array means that shorthand action IDs are not available
   *   for this plugin. See ConfigActionManager::convertActionToPluginId().
   * @param class-string|null $deriver
   *   (optional) The deriver class.
   *
   * @see \Drupal\Core\Config\Action\ConfigActionManager::convertActionToPluginId()
   */
  public function __construct(public readonly string $id, public readonly ?TranslatableMarkup $admin_label = NULL, public readonly array $entity_types = [], public readonly ?string $deriver = NULL) {
    if ($this->admin_label === NULL && $this->deriver === NULL) {
      throw new InvalidPluginDefinitionException($id, sprintf("The '%s' config action plugin must have either an admin label or a deriver", $id));
    }
  }

}

Members

Title Sort descending Modifiers Object type Summary
ConfigAction::__construct public function Constructs a ConfigAction attribute.

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