class ActionMethod

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

@internal This API is experimental.

Hierarchy

Expanded class hierarchy of ActionMethod

10 files declare their use of ActionMethod
Block.php in core/modules/block/src/Entity/Block.php
ConfigEntityBase.php in core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
ConfigTest.php in core/modules/config/tests/config_test/src/Entity/ConfigTest.php
DuplicatePluralizedMethodName.php in core/modules/config/tests/config_test/src/ConfigActionErrorEntity/DuplicatePluralizedMethodName.php
DuplicatePluralizedOtherMethodName.php in core/modules/config/tests/config_test/src/ConfigActionErrorEntity/DuplicatePluralizedOtherMethodName.php

... See full list

File

core/lib/Drupal/Core/Config/Action/Attribute/ActionMethod.php, line 15

Namespace

Drupal\Core\Config\Action\Attribute
View source
final class ActionMethod {
  
  /**
   * @param \Drupal\Core\Config\Action\Exists $exists
   *   Determines behavior of action depending on entity existence.
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup|string $adminLabel
   *   The admin label for the user interface.
   * @param bool|string $pluralize
   *   Determines whether to create a pluralized version of the method to enable
   *   the action to be called multiple times before saving the entity. The
   *   default behavior is to create an action with a plural form as determined
   *   by \Symfony\Component\String\Inflector\EnglishInflector::pluralize().
   *   For example, 'grantPermission' has a pluralized version of
   *   'grantPermissions'. If a string is provided this will be the full action
   *   ID. For example, if the method is called 'addArray' this can be set to
   *   'addMultipleArrays'. Set to FALSE if a pluralized version does not make
   *   logical sense.
   */
  public function __construct(public readonly Exists $exists = Exists::ErrorIfNotExists, public readonly TranslatableMarkup|string $adminLabel = '', public readonly bool|string $pluralize = TRUE) {
  }

}

Members

Title Sort descending Modifiers Object type Summary
ActionMethod::__construct public function

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