Skip to content
Snippets Groups Projects
Commit 01331e9e authored by danielveza's avatar danielveza Committed by jbrauer
Browse files

Issue #2679839 by scuba_fly, clemens.tolboom, Dylan Donkersgoed, joelpittet,...

Issue #2679839 by scuba_fly, clemens.tolboom, Dylan Donkersgoed, joelpittet, DanielVeza, szeidler, Cameron Tod, Dave Kopecek: Container elements and their children cannot be prepopulated in the 7.x-2.1 security update release
parent 16cdb63c
No related branches found
No related tags found
No related merge requests found
......@@ -56,22 +56,32 @@ function _prepopulate_request_walk(&$form, &$request_slice) {
$limited_types = array(
'actions',
'button',
'container',
'token',
'value',
'hidden',
'image_button',
'password',
'password_confirm',
'text_format',
'markup',
);
if (is_array($request_slice)) {
foreach (array_keys($request_slice) as $request_variable) {
if (element_child($request_variable) && !empty($form[$request_variable]) &&
(!isset($form[$request_variable]['#type']) || !in_array($form[$request_variable]['#type'], $limited_types))) {
if (!isset($form[$request_variable]['#access']) || $form[$request_variable]['#access'] != FALSE) {
_prepopulate_request_walk($form[$request_variable], $request_slice[$request_variable]);
$and_checks = array(
'is child' => element_child($request_variable),
'in form' => !empty($form[$request_variable]),
);
if (array_sum($and_checks) == count($and_checks)) {
$or_checks = array(
'no #type set' => !isset($form[$request_variable]['#type']),
'language container' => isset($form[$request_variable]['#language']) && isset($form[$request_variable][$form[$request_variable]['#language']]['#type']) && !in_array($form[$request_variable][$form[$request_variable]['#language']]['#type'], $limited_types),
'container' => isset($form[$request_variable]['#type']) && $form[$request_variable]['#type'] == 'container' && isset($form[$request_variable]['#language']) && isset($form[$request_variable][$form[$request_variable]['#language']][0]['#type']) && $form[$request_variable][$form[$request_variable]['#language']][0]['#type'] == 'text_format',
'allowed #type' => isset($form[$request_variable]['#type']) && !in_array($form[$request_variable]['#type'], $limited_types),
);
if (array_sum($or_checks) > 0) {
if (!isset($form[$request_variable]['#access']) || $form[$request_variable]['#access'] != FALSE) {
_prepopulate_request_walk($form[$request_variable], $request_slice[$request_variable]);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment