You are here

public function LatestRevisionUpdateRunner::validateConfigurationForm in Scheduled Updates 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides BaseUpdateRunner::validateConfigurationForm

File

src/Plugin/UpdateRunner/LatestRevisionUpdateRunner.php, line 80
Contains \Drupal\scheduled_updates\Plugin\UpdateRunner\LatestRevisionUpdateRunner

Class

LatestRevisionUpdateRunner
The Latest Revision Update Runner.

Namespace

Drupal\scheduled_updates\Plugin\UpdateRunner

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::validateConfigurationForm($form, $form_state);

  /** @var ScheduledUpdateTypeInterface $scheduled_update_type */
  $scheduled_update_type = $form_state
    ->get('scheduled_update_type');

  // Check if entity type to be updated supports revisions.
  if (!$this->updateUtils
    ->supportsRevisionUpdates($scheduled_update_type)) {

    // @todo Check if any bundles in update entity type is moderated
    $form_state
      ->setError($form['update_entity_type'], $this
      ->t('The latest revision runner cannot be used with an entity type that does not support revisions.'));
  }
}