Hi Mark, just wanted to let you know that I am receiving these warnings when I edit records with editablefields. Even though it throws the big nasty warnings, it does seem to update the records to the correct values. It gives one warning for each record that is updated. That is why I have three warnings below.

* warning: array_shift() [function.array-shift]: The argument should be an array in C:\WEBSITES\drupal\includes\form.inc on line 852.

* warning: array_shift() [function.array-shift]: The argument should be an array in C:\WEBSITES\drupal\includes\form.inc on line 852.

* warning: array_shift() [function.array-shift]: The argument should be an array in C:\WEBSITES\drupal\includes\form.inc on line 852.

Any idea on what is happening?

Let me know if you need more information.

Thanks again,
Glenn

CommentFileSizeAuthor
#13 editablefields.module.txt13.33 KBgmclelland

Comments

markfoodyburton’s picture

Status: Active » Postponed (maintainer needs more info)

Could you generate a backtrace.... or let me know the thing which causes this to happen....

Cheers

Mark.

gmclelland’s picture

Mark, I'm not sure what causes this to happen. I only notice it when I edit fields that are "editable." I'm sorry but I don't know what a backtrace is.

This post sort of explains my setup.

I would be more than happy to provide you with the information you, but you may need to tell me exactly what to do.

Thanks,
Glenn

markfoodyburton’s picture

Mmm, my explanation of how to get a backtrack working for you would probably not be right, so I suggest a google for that. Personally I was able to install xdebug, and that seems to be working for me.

Is it possible you can give me access to your site? Maybe send me a private message :-)

derhasi’s picture

I've the same problem.
It seems to be some problem with the form-fields' parents.

Line 844 to 864 in form.inc

/**
 * Helper function for form_set_value().
 *
 * We iterate over $parents and create nested arrays for them
 * in $form_values if needed. Then we insert the value into
 * the right array.
 */
function _form_set_value(&$form_values, $form, $parents, $value) {
  print_r($parents);
  $parent = array_shift($parents); //<=853
  if (empty($parents)) {
    $form_values[$parent] = $value;
  }
  else {
    if (!isset($form_values[$parent])) {
      $form_values[$parent] = array();
    }
    _form_set_value($form_values[$parent], $form, $parents, $value);
  }
  return $form;
}

But i can't see the exact problem.

derhasi’s picture

print_r() is not a part of the code, juste used it for research ;)

markfoodyburton’s picture

I can't replicate the problem at all.
Could you get a back-trace - and/or give me the minimum set up which causes it?

Cheers

Mark.

derhasi’s picture

I thought i found the reason:

when activating Auto-Nodetitles for the content-type, the error occurs. $value=NewNodeTitle and $parents='' is sent to _form_set_value .

At the moment I didn't find why.

Does this help you?

gmclelland’s picture

Yes, my site uses automatic node titles as well and I am the one having the problems above.

Mark,
When you replicated my site, did you include the automatic node titles module?

I will double check this by turning off automatic node titles and see if the problem goes away.

-Glenn

gmclelland’s picture

Ok, I turned off automatic node titles and that made the all the warnings go away.

-Glenn

derhasi’s picture

Title: Warnings when editing records » editablefields patch for auto_nodetitle problem
Status: Postponed (maintainer needs more info) » Needs review

I patched my editablefields.module with this:

line 103 (function: _handle_editablefield_form_input )

@@ -103,1 +103,1 @@
-        node_validate($node);
+        node_validate($node,array('title'=>array('#parents'=>array('title'))));

Now it does not cause the error anymore. The field's value changes, but the value of the nodetitle does not (the field is part of the autmoatic nodetitle).

So there has to be some code, that saves the new title. Can that be done?

derhasi’s picture

I extended the code a little with integrating the auto_nodetitle-function, to actualize the Nodetitle.

@@ -101,4 +101,4 @@
        $viewfield_stack=array();

 -        node_validate($node);
 +        node_validate($node,array('title'=>array('#parents'=>array('title'))));
        if (! form_get_errors()) {

@@ -109,4 +109,8
         $node=_editablefields_node_load_and_update($node->nid,$node);

 +        //This implements auto_nodetitle actualization
 +        if (variable_get('ant_'. $node->type, 0)) {
 +        	  auto_nodetitle_set_title($node);
 +        }
          node_save($node);
        }

This could also be some solution for http://drupal.org/node/173902

markfoodyburton’s picture

Thanks so much for this hard work !
Looks like you've got a solution.

If Glenn verifies that it works for him, then I'll commit the patch and release a new version

THANKS!

Cheers

Mark.

gmclelland’s picture

StatusFileSize
new13.33 KB

It does eliminate all the warnings, but the node doesn't receive an automaticnodetitle when you ADD a node through the "editablefields add new node" form.

A node DOES receive an automaticnodetitle when you edit a record through the editablefields form.

In addition to the code, I had to remove a closing "}" bracket on line 124.

I attached the updated the editablefields module I used, so you can make sure I'm made the correct changes.

Looks like it just needs a bit more code to accommodate the "add a new node" form to make it compatible with automaticnodetitles. :(

Almost there.

-Glenn

acidpotato’s picture

Status: Needs review » Closed (fixed)

Closing legacy issue.