You are here

public static function InsertFileWidgetUtility::validateStyles in Insert 8

An #element_validate function for the styles list on the settings form. Since when all styles are activated new styles should be enabled by default, the setting value needs to be changed to be able to detect that all styles were enabled when setting the styles the last time.

Parameters

array $element:

\Drupal\Core\Form\FormState $form_state:

File

src/Utility/InsertFileWidgetUtility.php, line 112

Class

InsertFileWidgetUtility

Namespace

Drupal\insert\Utility

Code

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