You are here

function simplify_taxonomy_vocabulary_form_submit in Simplify 8

Form submission handler for taxonomy_vocabulary_form().

See also

simplify_form_taxonomy_vocabulary_form_alter()

1 string reference to 'simplify_taxonomy_vocabulary_form_submit'
simplify_form_taxonomy_vocabulary_form_alter in ./simplify.module
Implements hook_form_FORM_ID_alter() for taxonomy_form_vocabulary().

File

./simplify.module, line 143
Hooks implemented by the simplify module.

Code

function simplify_taxonomy_vocabulary_form_submit($form, FormStateInterface $form_state) {
  $vocabulary = $form_state
    ->getValue('vid');

  // Get fields.
  $fields = $form_state
    ->getValue('simplify_taxonomies');
  $fields = array_keys(array_filter($fields));

  // Values aren't saved to a variable by default, so do it manually.
  \Drupal::configFactory()
    ->getEditable('simplify.vocabulary.' . $vocabulary)
    ->set('simplify_taxonomies', $fields)
    ->save();
}