You are here

public static function InsertUtility::validateList in Insert 8.2

An #element_validate function lists on the settings form. Since, when all list items are activated, items added later on should be enabled by default, the setting value needs to be changed to be able to detect that all items were enabled when having set the value the last time.

Parameters

array $element:

\Drupal\Core\Form\FormStateInterface $form_state:

File

src/Utility/InsertUtility.php, line 97

Class

InsertUtility

Namespace

Drupal\insert\Utility

Code

public static function validateList(array $element, FormStateInterface &$form_state) {
  if (array_key_exists('#options', $element) && array_values($element['#value']) == array_keys($element['#options'])) {
    $form_state
      ->setValue('<all>', '<all>');
  }
}