You are here

protected function ConfigSplitEntityForm::readValuesFromPicker in Configuration Split 8

Same name and namespace in other branches
  1. 2.0.x src/Form/ConfigSplitEntityForm.php \Drupal\config_split\Form\ConfigSplitEntityForm::readValuesFromPicker()

Read values selected depending on widget used: select or checkbox.

Parameters

array $pickerSelection: The form value array.

Return value

array Array of selected values

1 call to ConfigSplitEntityForm::readValuesFromPicker()
ConfigSplitEntityForm::submitForm in src/Form/ConfigSplitEntityForm.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

src/Form/ConfigSplitEntityForm.php, line 304

Class

ConfigSplitEntityForm
The entity form.

Namespace

Drupal\config_split\Form

Code

protected function readValuesFromPicker(array $pickerSelection) {
  if ($this
    ->useSelectList()) {
    $moduleSelection = $pickerSelection;
  }
  else {

    // Checkboxes return a value for each item. We only keep the selected one.
    $moduleSelection = array_filter($pickerSelection, function ($value) {
      return $value;
    });
  }
  return $moduleSelection;
}