Skip to content
Snippets Groups Projects
Commit 32e22f1f authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

#79577 by chx. Cleanup- remove $posted and only set $edit if needed.

parent 4fdc90e1
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -494,13 +494,12 @@ function form_builder($form_id, $form) { ...@@ -494,13 +494,12 @@ function form_builder($form_id, $form) {
$form['#id'] = 'edit-' . implode('-', $form['#parents']); $form['#id'] = 'edit-' . implode('-', $form['#parents']);
} }
$posted = (($form['#programmed']) || ((!isset($form['#access']) || $form['#access']) && isset($_POST['edit']) && ($_POST['edit']['form_id'] == $form_id)));
$edit = $posted ? $form['#post']['edit'] : array();
foreach ($form['#parents'] as $parent) {
$edit = isset($edit[$parent]) ? $edit[$parent] : NULL;
}
if (!isset($form['#value']) && !array_key_exists('#value', $form)) { if (!isset($form['#value']) && !array_key_exists('#value', $form)) {
if ($posted) { if (($form['#programmed']) || ((!isset($form['#access']) || $form['#access']) && isset($_POST['edit']) && ($_POST['edit']['form_id'] == $form_id))) {
$edit = $form['#post']['edit'];
foreach ($form['#parents'] as $parent) {
$edit = isset($edit[$parent]) ? $edit[$parent] : NULL;
}
switch ($form['#type']) { switch ($form['#type']) {
case 'checkbox': case 'checkbox':
$form['#value'] = !empty($edit) ? $form['#return_value'] : 0; $form['#value'] = !empty($edit) ? $form['#return_value'] : 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment