Hi
I get this error message when I am adding a new field of type video_upload to a content type.
I see the following lines of code at this location. Any idea as to what could be causing this error?
// @fixme - This need to be reviewed. The reason this is required
// is that the Drupal Form API doesn't allow js to change
// the values of hidden variables, so it must be done here.
// Supposedly it is dangerous to do so, thus the need for a
// review.
foreach ($_POST[$field_name] as $key => $item) {
if ($_POST[$field_name][$key]['id']) {
$node->{$field_name}[$key]['id'] = $_POST[$field_name][$key]['id'];
$items[$key]['id'] = $node->{$field_name}[$key]['id'];
}
}
Thanks
Krishna
Comments
Comment #1
kkrgopalan CreditAttribution: kkrgopalan commentedSorry for replying to my previous post
I added the following and it seems to fix the error but I am not sure if it has any other impacts
if (is_array($_POST[$field_name]))
// @fixme - This need to be reviewed. The reason this is required
// is that the Drupal Form API doesn't allow js to change
// the values of hidden variables, so it must be done here.
// Supposedly it is dangerous to do so, thus the need for a
// review.
if (is_array($_POST[$field_name]))
foreach ($_POST[$field_name] as $key => $item) {
if ($_POST[$field_name][$key]['id']) {
$node->{$field_name}[$key]['id'] = $_POST[$field_name][$key]['id'];
$items[$key]['id'] = $node->{$field_name}[$key]['id'];
}
}
Comment #2
jhedstromThat fix should work fine. I'll try and get this committed to CVS soon. Thanks.
Comment #3
kkrgopalan CreditAttribution: kkrgopalan commentedThank you! Appreciate the prompt response.
Comment #4
jhedstromThis has been fixed in the 5.x dev branch.