You are here

protected function Form::massageArrayValues in GridStack 8.2

Cleans up array form.

1 call to Form::massageArrayValues()
Form::validateConfigurationForm in src/Plugin/gridstack/stylizer/Form.php

File

src/Plugin/gridstack/stylizer/Form.php, line 144

Class

Form
Provides the form elements.

Namespace

Drupal\gridstack\Plugin\gridstack\stylizer

Code

protected function massageArrayValues($key, array $name, FormStateInterface $form_state) {
  $values = $form_state
    ->getValue($name);

  // Respects rgba, aside from hexcode. Only remove default black.
  if ($key == 'colors') {
    foreach ($values as &$value) {
      if ($value == "#000000") {
        $value = '';
      }
    }
  }
  $form_state
    ->setValue($name, array_filter($values));
}