Commit b1d18e5b authored by yched's avatar yched

#705512 by cha0s, roderick: 'add more' button - fix PHP 5.3 compatibility

parent 187e242a
......@@ -6,6 +6,7 @@ CCK 6.x-2.x
- #863226 by KarenS: make sure we have a function that will return inactive instances when other instances of the same field are still active.
- #887742 by yched: fix notices in _content_get_formatter() in some Views
- #736440 by yched, dhthwy: fix memory leaks on long running migration scripts (e.g. migrate.module)
- #705512 by cha0s, roderick: 'add more' button - fix PHP5.3 compatibility
CCK 6.x-2.8
===========
......
......@@ -321,7 +321,14 @@ function content_add_more_js($type_name_url, $field_name) {
$form_state['item_count'] = array($field_name => count($_POST[$field_name]) + 1);
$form_element = content_field_form($form, $form_state, $field);
// Let other modules alter it.
drupal_alter('form', $form_element, array(), 'content_add_more_js');
// We pass an empty array as hook_form_alter's usual 'form_state' parameter,
// instead of $form_atate (for reasons we may never remember).
// However, this argument is still expected to be passed by-reference
// (and PHP5.3 will throw an error if it isn't.) This leads to:
$data = &$form_element;
$empty_form_state = array();
$data['__drupal_alter_by_ref'] = array(&$empty_form_state);
drupal_alter('form', $data, 'content_add_more_js');
// Add the new element at the right place in the (original, unbuilt) form.
if (module_exists('fieldgroup') && ($group_name = _fieldgroup_field_get_group($type['type'], $field_name))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment