public function ConfigHandler::submitForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views_ui/src/Form/Ajax/ConfigHandler.php \Drupal\views_ui\Form\Ajax\ConfigHandler::submitForm()
- 9 core/modules/views_ui/src/Form/Ajax/ConfigHandler.php \Drupal\views_ui\Form\Ajax\ConfigHandler::submitForm()
File
- core/modules/views_ui/src/Form/Ajax/ConfigHandler.php, line 204
Class
- ConfigHandler
- Provides a form for configuring an item in the Views UI.
Namespace
Drupal\views_ui\Form\Ajax
Code
public function submitForm(array &$form, FormStateInterface $form_state) {
$view = $form_state
->get('view');
$display_id = $form_state
->get('display_id');
$id = $form_state
->get('id');
$handler = $form_state
->get('handler');
$handler
->submitOptionsForm($form['options'], $form_state);
$item = $handler->options;
$types = ViewExecutable::getHandlerTypes();
$handler_type = $type = $form_state
->get('type');
if (!empty($types[$type]['type'])) {
$handler_type = $types[$type]['type'];
}
$override = NULL;
$executable = $view
->getExecutable();
if ($executable->display_handler
->useGroupBy() && !empty($item['group_type'])) {
if (empty($executable->query)) {
$executable
->initQuery();
}
$aggregate = $executable->query
->getAggregationInfo();
if (!empty($aggregate[$item['group_type']]['handler'][$type])) {
$override = $aggregate[$item['group_type']]['handler'][$type];
}
}
$handler = Views::handlerManager($handler_type)
->getHandler($item, $override);
$handler
->init($executable, $executable->display_handler, $item);
$options = $handler
->submitFormCalculateOptions($handler->options, $form_state
->getValue('options', []));
$handler
->unpackOptions($handler->options, $options, NULL, FALSE);
$executable
->setHandler($display_id, $type, $id, $handler->options);
if (isset($view->temporary_options[$type][$id])) {
unset($view->temporary_options[$type][$id]);
}
$view
->cacheSet();
}