function termcase_custom_form_submit in Termcase 8
Submit callback to save Termcase settings with the Vocabulary.
1 string reference to 'termcase_custom_form_submit'
- termcase_form_taxonomy_vocabulary_form_alter in ./
termcase.module - Implements hook_form_FORM_ID_alter().
File
- ./
termcase.module, line 102 - The Termcase module gives you the option to specify specific case-formatting on terms.
Code
function termcase_custom_form_submit($form, FormStateInterface $form_state) {
$vocab_machine_name = $form_state
->getValue('vid');
$config = \Drupal::configFactory()
->getEditable('termcase.settings');
$config
->set('termcase_options_' . $vocab_machine_name, $form_state
->getValue('termcase_options'))
->set('termcase_update_terms_' . $vocab_machine_name, $form_state
->getValue('termcase_update_terms'))
->save();
if ($form_state
->getValue('termcase_update_terms')) {
// Call batch process.
$terms = \Drupal::entityTypeManager()
->getStorage('taxonomy_term')
->loadTree($vocab_machine_name);
termcase_batch_update($terms, $form_state
->getValue('termcase_options'));
}
}