public function VocabularyListController::submitForm

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: An associative array containing the current state of the form.

Overrides FormInterface::submitForm

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyListController.php, line 151
Contains \Drupal\taxonomy\VocabularyListController.

Class

VocabularyListController
Provides a listing of vocabularies.

Namespace

Drupal\taxonomy

Code

public function submitForm(array &$form, array &$form_state) {
  $vocabularies = $form_state['values']['vocabularies'];
  $entities = entity_load_multiple($this->entityType, array_keys($vocabularies));
  foreach ($vocabularies as $id => $value) {
    if (isset($entities[$id]) && $value['weight'] != $entities[$id]
      ->get('weight')) {

      // Update changed weight.
      $entities[$id]
        ->set('weight', $value['weight']);
      $entities[$id]
        ->save();
    }
  }
  drupal_set_message(t('The configuration options have been saved.'));
}