You are here

abstract class WorkflowTypeStateFormBase in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/workflows/src/Plugin/WorkflowTypeStateFormBase.php \Drupal\workflows\Plugin\WorkflowTypeStateFormBase
  2. 9 core/modules/workflows/src/Plugin/WorkflowTypeStateFormBase.php \Drupal\workflows\Plugin\WorkflowTypeStateFormBase

A base class for workflow type state forms.

Hierarchy

Expanded class hierarchy of WorkflowTypeStateFormBase

2 files declare their use of WorkflowTypeStateFormBase
ComplexTestTypeStateForm.php in core/modules/workflows/tests/modules/workflow_type_test/src/Form/ComplexTestTypeStateForm.php
ContentModerationStateForm.php in core/modules/content_moderation/src/Form/ContentModerationStateForm.php

File

core/modules/workflows/src/Plugin/WorkflowTypeStateFormBase.php, line 14

Namespace

Drupal\workflows\Plugin
View source
abstract class WorkflowTypeStateFormBase implements PluginFormInterface, PluginAwareInterface {
  use StringTranslationTrait;

  /**
   * The workflow type.
   *
   * @var \Drupal\workflows\WorkflowTypeInterface
   */
  protected $workflowType;

  /**
   * {@inheritdoc}
   */
  public function setPlugin(PluginInspectionInterface $plugin) {
    $this->workflowType = $plugin;
  }

  /**
   * {@inheritdoc}
   */
  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  }

  /**
   * {@inheritdoc}
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    $values = $form_state
      ->getValues();
    $state = $form_state
      ->get('state');
    $configuration = $this->workflowType
      ->getConfiguration();
    $configuration['states'][$state
      ->id()] = $values + $configuration['states'][$state
      ->id()];
    $this->workflowType
      ->setConfiguration($configuration);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PluginFormInterface::buildConfigurationForm public function Form constructor. 9
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 1
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
WorkflowTypeStateFormBase::$workflowType protected property The workflow type.
WorkflowTypeStateFormBase::setPlugin public function Sets the plugin for this object. Overrides PluginAwareInterface::setPlugin
WorkflowTypeStateFormBase::submitConfigurationForm public function Form submission handler. Overrides PluginFormInterface::submitConfigurationForm
WorkflowTypeStateFormBase::validateConfigurationForm public function Form validation handler. Overrides PluginFormInterface::validateConfigurationForm