public ViewUI::getOverrideValues($form, FormStateInterface $form_state)
Return the was_defaulted, is_defaulted and revert state of a form.
File
- core/modules/views_ui/src/ViewUI.php, line 349
Class
- ViewUI
- Stores UI related temporary settings.
Namespace
Drupal\views_ui
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 | public function getOverrideValues( $form , FormStateInterface $form_state ) { // Make sure the dropdown exists in the first place. if ( $form_state ->hasValue( array ( 'override' , 'dropdown' ))) { // #default_value is used to determine whether it was the default value or not. // So the available options are: $display, 'default' and 'default_revert', not 'defaults'. $was_defaulted = ( $form [ 'override' ][ 'dropdown' ][ '#default_value' ] === 'defaults' ); $dropdown = $form_state ->getValue( array ( 'override' , 'dropdown' )); $is_defaulted = ( $dropdown === 'default' ); $revert = ( $dropdown === 'default_revert' ); if ( $was_defaulted !== $is_defaulted && isset( $form [ '#section' ])) { // We're changing which display these values apply to. // Update the #section so it knows what to mark changed. $form [ '#section' ] = str_replace ( 'default-' , $form_state ->get( 'display_id' ) . '-' , $form [ '#section' ]); } } else { // The user didn't get the dropdown for overriding the default display. $was_defaulted = FALSE; $is_defaulted = FALSE; $revert = FALSE; } return array ( $was_defaulted , $is_defaulted , $revert ); } |
Please login to continue.