public function DepthUpdateForm::submitForm in Taxonomy Term Depth 8
Same name and namespace in other branches
- 8.2 src/Form/DepthUpdateForm.php \Drupal\taxonomy_term_depth\Form\DepthUpdateForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ DepthUpdateForm.php, line 127
Class
Namespace
Drupal\taxonomy_term_depth\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$identity = isset($form_state
->getTriggeringElement()['#identity']) ? $form_state
->getTriggeringElement()['#identity'] : 'unknown';
$options = array();
$options['vids'] = $form_state
->getValue('vid');
switch ($identity) {
case 'btn_rebuild_all_voc':
// Apply "btn_rebuild_all" to all vocabularies
$options['vids'] = NULL;
case 'btn_rebuild_all':
batch_set(array(
'operations' => array(
array(
'taxonomy_term_depth_batch_callbacks_update_term_depth',
array(
$options,
),
),
),
'title' => t('Updating depths for all terms'),
'file' => TAXONOMY_TERM_DEPTH_ROOT_REL . '/taxonomy_term_depth.batch.inc',
));
break;
case 'btn_rebuild_all_voc_queue':
taxonomy_term_depth_queue_manager()
->queueBatch();
break;
case 'btn_rebuild_all_queue':
taxonomy_term_depth_queue_manager($options['vids'])
->queueBatch();
break;
case 'btn_rebuild_missing_all_voc_queue':
taxonomy_term_depth_queue_manager()
->queueBatchMissing();
break;
case 'btn_rebuild_missing_queue':
taxonomy_term_depth_queue_manager($options['vids'])
->queueBatchMissing();
break;
default:
drupal_set_message(t('Wrong operation selected'));
}
}