Hi,
Arrange fields working well, but this annoying message keeps popping up,
Notice: Array to string conversion in arrange_fields_form_alter() (line 1201 of /var/www/html/sites/all/modules/arrange_fields/arrange_fields.module).
I patched the issue with this :
$string = implode($form["#attributes"]["class"]);
$form["#attributes"]["class"] = $string . " arrange-fields-container "; ##1201: arrange_fields.module
$form["#attributes"]["class"] .= " arrange-fields-container-$fid ";
this may be related to hierarchical_select, as I am using that module, but this modification seems to have done the trick, for now, Im sure there is a more elegant way of doing the same thing, but this got rid of the array to string conversion.
thanks
Comments
Comment #1
richardp CreditAttribution: richardp commentedThanks for the tip. Yeah, it's probably that the other module you mentioned is doing something to the array which my module isn't expecting.
Thanks for your code sample.
As I'm sure you know (but I'll comment on anyway for others), you could always lower the PHP error reporting level, since "notice" messages aren't really errors or even warnings-- just messages to the programmer to let them know about possible typos or other mistakes in code. Drupal 6 used to lower the error reporting level for you to not show notices, but they took it out in 7.
Anyway, thanks again
Richard
Comment #2
deepbluesolutions CreditAttribution: deepbluesolutions commentedHi Richard
Im still having this issue with this module, had to patch again after last update, are there implications for making this change in the module?
regards
Daren
Comment #3
Ole Martin CreditAttribution: Ole Martin commenteddeepbluesolutions:
I also have this error. Where should I add the code? Can you give more detailed info about this?
Comment #4
kenrbnsn CreditAttribution: kenrbnsn commentedI got this notice at line 1258 of the current released module. That line is
The code assumes that $form["#attributes"]["class"] is a string, but (at least in my case) it's an array (with one element in it), which is the reason for the notice.
I fixed the issue by replacing lines 1258 & 1259 in arrange_fields.module with
These lines could be further consolidated by doing:
This really should be submitted as a patch and fully tested.
Ken
Comment #5
jojojibba CreditAttribution: jojojibba commentedKen,
I replaced 1258 and 1259 with your consolidated patch lines and it worked wonderfully.
Thank you for this!
John
Comment #6
funkatron101 CreditAttribution: funkatron101 commentedI made the suggestion per Ken, but not I am getting this error.
Notice: Undefined index: #attributes in arrange_fields_form_alter() (line 1258 of /home/content/71/10383771/html/sites/all/modules/arrange_fields/arrange_fields.module).
Notice: Undefined index: #attributes in arrange_fields_form_alter() (line 1261 of /home/content/71/10383771/html/sites/all/modules/arrange_fields/arrange_fields.module).
Notice: Undefined index: class in arrange_fields_form_alter() (line 1261 of /home/content/71/10383771/html/sites/all/modules/arrange_fields/arrange_fields.module).
It's happening in the account access form.
Comment #7
richardp CreditAttribution: richardp commentedOkay, I have rolled these changes into a new version -- 7.x-1.11.
For those interested, I have also added an experimental new feature, on the settings page, for allowing fields to be snapped to the grid when resizing.
Thanks for your help on this one, Ken.
Richard
Comment #8
funkatron101 CreditAttribution: funkatron101 commentedThe update worked great! The warnings are gone!
Thanks
Comment #9
richardp CreditAttribution: richardp commentedSure thing. On the arrange form itself, there is a button at the top which says "reset position data" or something to that effect. That will revert your form to its default state. Do NOT click the Save button after that. You can just leave the page, and your form will be displayed however Drupal would normally display it (w/o the Arrange Fields module)