function ViewUI::getOverrideValues
Same name in other branches
- 9 core/modules/views_ui/src/ViewUI.php \Drupal\views_ui\ViewUI::getOverrideValues()
- 8.9.x core/modules/views_ui/src/ViewUI.php \Drupal\views_ui\ViewUI::getOverrideValues()
- 11.x core/modules/views_ui/src/ViewUI.php \Drupal\views_ui\ViewUI::getOverrideValues()
Return the was_defaulted, is_defaulted and revert state of a form.
2 calls to ViewUI::getOverrideValues()
- ViewUI::standardSubmit in core/
modules/ views_ui/ src/ ViewUI.php - Basic submit handler applicable to all 'standard' forms.
- ViewUI::submitItemAdd in core/
modules/ views_ui/ src/ ViewUI.php - Submit handler for adding new item(s) to a view.
File
-
core/
modules/ views_ui/ src/ ViewUI.php, line 362
Class
- ViewUI
- Stores UI related temporary settings.
Namespace
Drupal\views_uiCode
public function getOverrideValues($form, FormStateInterface $form_state) {
// Make sure the dropdown exists in the first place.
if ($form_state->hasValue([
'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([
'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 [
$was_defaulted,
$is_defaulted,
$revert,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.