function ConfigAction::__construct

Same name in other branches
  1. 10 core/lib/Drupal/Core/Config/Action/Attribute/ConfigAction.php \Drupal\Core\Config\Action\Attribute\ConfigAction::__construct()

Constructs a ConfigAction attribute.

Parameters

string $id: The plugin ID.

\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.

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().

class-string|null $deriver: (optional) The deriver class.

Overrides Plugin::__construct

See also

\Drupal\Core\Config\Action\ConfigActionManager::convertActionToPluginId()

File

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

Class

ConfigAction
Defines a ConfigAction attribute object.

Namespace

Drupal\Core\Config\Action\Attribute

Code

public function __construct(string $id, ?TranslatableMarkup $admin_label = NULL, array $entity_types = [], ?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));
    }
}

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