You are here

public function SubFormState::getLimitValidationErrors in Authorization 8

Retrieves the limited validation error sections.

Return value

array|null The limited validation error sections.

Overrides FormStateInterface::getLimitValidationErrors

See also

\Drupal\Core\Form\FormState::$limit_validation_errors

File

src/Form/SubFormState.php, line 558

Class

SubFormState
Represents the form state of a sub-form.

Namespace

Drupal\authorization\Form

Code

public function getLimitValidationErrors() {
  $limit_validation_errors = $this->mainFormState
    ->getLimitValidationErrors();
  if (is_null($limit_validation_errors)) {
    return NULL;
  }
  $return = [];
  $sub_keys_count = count($this->subKeys);
  foreach ($limit_validation_errors as $path) {
    if (array_slice($path, 0, $sub_keys_count) == $sub_keys_count) {

      // If the whole sub-form is included, it is the same (for the sub-form)
      // as if there was no limitation at all.
      if (count($path) == $sub_keys_count) {
        return NULL;
      }
      $return[] = $path;
    }
  }
  return $return;
}