You are here

public static function FormOperations::validateDefaultWorkspace in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workspaces/src/FormOperations.php \Drupal\workspaces\FormOperations::validateDefaultWorkspace()

Validation handler which sets a validation error for all unsupported forms.

File

core/modules/workspaces/src/FormOperations.php, line 112

Class

FormOperations
Defines a class for reacting to form operations.

Namespace

Drupal\workspaces

Code

public static function validateDefaultWorkspace(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->get('workspace_safe') !== TRUE) {
    $form_state
      ->setError($form, new TranslatableMarkup('This form can only be submitted in the default workspace.'));
  }
}