diff --git a/core/modules/content_moderation/src/Plugin/Action/ModerationStateChange.php b/core/modules/content_moderation/src/Plugin/Action/ModerationStateChange.php index 50dc96395a..0e01430b9b 100644 --- a/core/modules/content_moderation/src/Plugin/Action/ModerationStateChange.php +++ b/core/modules/content_moderation/src/Plugin/Action/ModerationStateChange.php @@ -95,19 +95,19 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta '#default_value' => $this->configuration['workflow'], '#required' => TRUE, '#ajax' => [ - 'callback' => [get_called_class(), 'configurationFormAjax'], + 'callback' => [static::class, 'configurationFormAjax'], 'wrapper' => 'edit-configuration', ], ]; $form['configuration']['workflow_submit'] = [ '#type' => 'submit', - '#value' => t('Change workflow'), - '#limit_validation_errors' => [], + '#value' => $this->t('Change workflow'), + '#limit_validation_errors' => [['workflow']], '#attributes' => [ 'class' => ['js-hide'], ], - '#submit' => [[get_class($this), 'configurationFormAjaxSubmit']], + '#submit' => [[static::class, 'configurationFormAjaxSubmit']], ]; if (!$workflow = $form_state->getValue('workflow')) { @@ -148,12 +148,10 @@ public static function configurationFormAjax($form, FormStateInterface $form_sta /** * Submit configuration for the non-JS case. * - * @see static::fieldSettingsForm() + * @see static::buildConfigurationForm() */ public static function configurationFormAjaxSubmit($form, FormStateInterface $form_state) { - $input = $form_state->getUserInput(); - // Get the workflow value from user input so that we can rebuild the form. - $form_state->setValue('workflow', $input['workflow']); + // Rebuild the form. $form_state->setRebuild(); } diff --git a/core/modules/content_moderation/tests/src/Kernel/ActionConfigSchemaTest.php b/core/modules/content_moderation/tests/src/Kernel/ActionConfigSchemaTest.php index 8263458214..57278a1f0e 100644 --- a/core/modules/content_moderation/tests/src/Kernel/ActionConfigSchemaTest.php +++ b/core/modules/content_moderation/tests/src/Kernel/ActionConfigSchemaTest.php @@ -57,7 +57,7 @@ protected function setUp() { ], 'plugin' => 'moderation_state_change:node', ]); - $action->trustData()->save(); + $action->save(); $action = Action::create([ 'id' => 'change_moderation_state_to_published', @@ -69,7 +69,7 @@ protected function setUp() { ], 'plugin' => 'moderation_state_change:node', ]); - $action->trustData()->save(); + $action->save(); } /**