You are here

public function Taxonomy::submitConfigurationForm in Workbench Access 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides AccessControlHierarchyBase::submitConfigurationForm

File

src/Plugin/AccessControlHierarchy/Taxonomy.php, line 448

Class

Taxonomy
Defines a hierarchy based on a Vocabulary.

Namespace

Drupal\workbench_access\Plugin\AccessControlHierarchy

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  $settings = $form_state
    ->getValues();
  if (empty($settings['fields'])) {
    $settings['fields'] = [];
  }

  // Saving 'validate' can cause schema errors.
  unset($settings['validate']);
  $settings['vocabularies'] = array_values(array_filter($settings['vocabularies']));
  $settings['fields'] = array_values(array_map(function ($item) {
    list($entity_type, $bundle, $field_name) = explode(':', $item);
    return [
      'entity_type' => $entity_type,
      'bundle' => $bundle,
      'field' => $field_name,
    ];
  }, array_filter($settings['fields'])));
  $this->configuration = $settings;
}