function tvi_submit_handler in Taxonomy Views Integrator 8
Same name and namespace in other branches
- 6 includes/tvi.admin.inc \tvi_submit_handler()
- 7 includes/tvi.admin.inc \tvi_submit_handler()
Submit handler attached to term and vocabulary forms.
Parameters
array $form: Settings form render array.
\Drupal\Core\Form\FormStateInterface $form_state: Submitted form state.
1 string reference to 'tvi_submit_handler'
- _tvi_settings_form in ./
tvi.module - Helper function to construct the forms for both term and vocab edit forms.
File
- ./
tvi.module, line 256 - Allow views to be used instead of default taxonomy term page behavior.
Code
function tvi_submit_handler(array $form, FormStateInterface $form_state) {
$entity = $form_state
->getBuildInfo()['callback_object']
->getEntity();
$entity_type = $entity
->getEntityType()
->id();
$form_values = $form_state
->getValues();
if ($form_values['tvi_enable_override']) {
Drupal::configFactory()
->getEditable('tvi.' . $entity_type . '.' . $entity
->id())
->set('enable_override', $form_values['tvi_enable_override'])
->set('view', $form_values['tvi_view'])
->set('view_display', $form_values['tvi_view_display'])
->set('inherit_settings', $form_values['tvi_inherit_settings'])
->set('pass_arguments', $form_values['tvi_pass_arguments'])
->save();
}
else {
Drupal::configFactory()
->getEditable('tvi.' . $entity_type . '.' . $entity
->id())
->delete();
}
}