public ConfigHandler::submitForm(array &$form, FormStateInterface $form_state)
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 ViewsFormBase::submitForm
File
- core/modules/views_ui/src/Form/Ajax/ConfigHandler.php, line 203
Class
- ConfigHandler
- Provides a form for configuring an item in the Views UI.
Namespace
Drupal\views_ui\Form\Ajax
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 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' ); // Run it through the handler's submit function. $handler ->submitOptionsForm( $form [ 'options' ], $form_state ); $item = $handler ->options; $types = ViewExecutable::getHandlerTypes(); // For footer/header $handler_type is area but $type is footer/header. // For all other handle types it's the same. $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 ]; } } // Create a new handler and unpack the options from the form onto it. We // can use that for storage. $handler = Views::handlerManager( $handler_type )->getHandler( $item , $override ); $handler ->init( $executable , $executable ->display_handler, $item ); // Add the incoming options to existing options because items using // the extra form may not have everything in the form here. $options = $handler ->submitFormCalculateOptions( $handler ->options, $form_state ->getValue( 'options' , [])); // This unpacks only options that are in the definition, ensuring random // extra stuff on the form is not sent through. $handler ->unpackOptions( $handler ->options, $options , NULL, FALSE); // Store the item back on the view $executable ->setHandler( $display_id , $type , $id , $handler ->options); // Ensure any temporary options are removed. if (isset( $view ->temporary_options[ $type ][ $id ])) { unset( $view ->temporary_options[ $type ][ $id ]); } // Write to cache $view ->cacheSet(); } |
Please login to continue.