class WorkflowType

Same name in this branch
  1. 11.x core/modules/workflows/src/Annotation/WorkflowType.php \Drupal\workflows\Annotation\WorkflowType
Same name and namespace in other branches
  1. 9 core/modules/workflows/src/Annotation/WorkflowType.php \Drupal\workflows\Annotation\WorkflowType
  2. 8.9.x core/modules/workflows/src/Annotation/WorkflowType.php \Drupal\workflows\Annotation\WorkflowType
  3. 10 core/modules/workflows/src/Attribute/WorkflowType.php \Drupal\workflows\Attribute\WorkflowType
  4. 10 core/modules/workflows/src/Annotation/WorkflowType.php \Drupal\workflows\Annotation\WorkflowType

Defines a Workflow type attribute object.

Plugin Namespace: Plugin\WorkflowType

For a working example, see \Drupal\content_moderation\Plugin\Workflow\ContentModerate

Attributes

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

Hierarchy

Expanded class hierarchy of WorkflowType

See also

\Drupal\workflows\WorkflowTypeInterface

\Drupal\workflows\WorkflowTypeManager

workflow_type_info_alter()

Plugin API

7 files declare their use of WorkflowType
ComplexTestType.php in core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/ComplexTestType.php
ContentModeration.php in core/modules/content_moderation/src/Plugin/WorkflowType/ContentModeration.php
PredefinedStatesWorkflowTestType.php in core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/PredefinedStatesWorkflowTestType.php
RequiredStateTestType.php in core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/RequiredStateTestType.php
TestType.php in core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/TestType.php

... See full list

File

core/modules/workflows/src/Attribute/WorkflowType.php, line 21

Namespace

Drupal\workflows\Attribute
View source
class WorkflowType extends Plugin {
  
  /**
   * States required to exist.
   *
   * Normally supplied by WorkflowType::defaultConfiguration().
   */
  public array $required_states = [];
  
  /**
   * A list of optional form classes implementing PluginFormInterface.
   *
   * Forms which will be used for the workflow UI are:
   * - 'configure' (\Drupal\workflows\WorkflowTypeInterface::PLUGIN_FORM_KEY)
   * - 'state' (\Drupal\workflows\StateInterface::PLUGIN_FORM_KEY)
   * - 'transition' (\Drupal\workflows\TransitionInterface::PLUGIN_FORM_KEY)
   *
   * @see \Drupal\Core\Plugin\PluginWithFormsInterface
   * @see \Drupal\Core\Plugin\PluginFormInterface
   * @see \Drupal\workflows\Plugin\WorkflowTypeConfigureFormBase
   * @see \Drupal\workflows\Plugin\WorkflowTypeStateFormBase
   * @see \Drupal\workflows\Plugin\WorkflowTypeTransitionFormBase
   * @see \Drupal\workflows\WorkflowTypeInterface::PLUGIN_FORM_KEY
   * @see \Drupal\workflows\StateInterface::PLUGIN_FORM_KEY
   * @see \Drupal\workflows\TransitionInterface::PLUGIN_FORM_KEY
   */
  public array $forms = [];
  
  /**
   * Constructs an Action attribute.
   *
   * @param string $id
   *   The plugin ID.
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $label
   *   The label of the action.
   * @param string[] $forms
   *   A list of optional form classes implementing PluginFormInterface.
   * @param string[] $required_states
   *   States required to exist.
   */
  public function __construct(public readonly string $id, public readonly ?TranslatableMarkup $label = NULL, array $forms = [], array $required_states = []) {
    $this->forms = $forms;
    $this->required_states = $required_states;
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AttributeBase::$class protected property The class used for this attribute class.
AttributeBase::$provider protected property The provider of the attribute class.
AttributeBase::get public function Gets the value of an attribute. Overrides AttributeInterface::get 7
AttributeBase::getClass public function Gets the class of the attribute class. Overrides AttributeInterface::getClass 1
AttributeBase::getId public function Gets the unique ID for this attribute class. Overrides AttributeInterface::getId
AttributeBase::getProvider public function Gets the name of the provider of the attribute class. Overrides AttributeInterface::getProvider
AttributeBase::setClass public function Sets the class of the attributed class. Overrides AttributeInterface::setClass 1
AttributeBase::setProvider public function Sets the name of the provider of the attribute class. Overrides AttributeInterface::setProvider 1
WorkflowType::$forms public property A list of optional form classes implementing PluginFormInterface.
WorkflowType::$required_states public property States required to exist.
WorkflowType::__construct public function Constructs an Action attribute. Overrides Plugin::__construct

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