Problem/Motivation

Inability to change settings

Steps to reproduce

- Create a field group and save it
- Click the settings "cog" icon
- An error 500 is being raised

Proposed resolution

1) Disable the module
2) Modify bootstrap_fieldgroup.module - Line #116
From:

  $form = array(
    'instance_settings' => array(
      '#tree' => TRUE,
      '#weight' => 5,
    ),
  );

To:

  $form = array(
    'instance_settings' => array(),
  );

The error is happening because once module_invoke_all gets called, multiple methods return entries for the entries the $form array.
- field_group_field_group_format_settings
- bootstrap_fieldgroup_field_group_format_settings

Inside the method module_invoke_all, a call to array_merge_recursive converts the '#tree' and '#weight' entries to arrays making the method element_children crash, because '#weight' is expected to be number/scalar not an array.

CommentFileSizeAuthor
#3 3191992-3.patch525 bytesaritrika.d
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mojiro created an issue. See original summary.

mojiro’s picture

Issue summary: View changes
aritrika.d’s picture

StatusFileSize
new525 bytes

Created a patch for this issue,please review the patch

aritrika.d’s picture

Status: Active » Needs review
mojiro’s picture

Status: Needs review » Reviewed & tested by the community

It looks good aritrika.d. Thank you for your quick response.

yntun’s picture

@aritrika.d the patch works, thanks for that.

abelaguado’s picture

Drupal 7.77
Bootstrap_fieldgroup-7.x-1.x-dev

Patch doesn't work for me.
Back to this trick: https://www.drupal.org/project/drupal/issues/3187397#comment-13951603

julien.reulos’s picture

The patch is working fine, thanks! Drupal 7.77 + bootstrap_fieldgroup 7.x-1.2.

ilfelice’s picture

Howdy,

Tried the patch on #3, and the problem persists. Using Drupal 7.77 + bootstrap_fieldgroup 7.x-1.2.

I forgot to disable the module before applying the patch; does that make a difference?

Any ideas on where I can further look at will be greatly appreciated.

mojiro’s picture

Issue summary: View changes
mojiro’s picture

Hello jorgemare and abelaguado,

Could you please describe your settings? are you able to provide any log entries?

Would you like to try one more patch?

Instead of:

  $form = array(
    'instance_settings' => array(),
  );

... please try:

  $form = array();

jorgemare,
you do not need to disable the module to make the patch effective.

abelaguado’s picture

Hi mojiro.

Same Error with your last suggestion:

$form = array();
Instead of:

$form = array(
    'instance_settings' => array(),
  );

"Error: Unsupported operand types en element_children() (línea 6671 /includes/common.inc"

Drupal 7.77
Bootstrap_fieldgroup-7.x-1.x-dev

Thanks for your help.

ilfelice’s picture

Hi @mojiro!

Thank you for your fast response.

I tried the latest change, but the error persists.

This is a fairly big site, with several content types and paragraph bundles. I use Field Group and Bootstrap Field Group to format both the edit forms and the display of content. Been using this setup for several years now, and it has always worked fine.

Now, this error occurs whenever I try to edit any (regular or bootstrap) field group, regardless of whether it is in a content type or a paragraph bundle.

I do not see anything related in the dblog. Is there anywhere else I should be looking perhaps?

Thanks again for your help!

pinueve made their first commit to this issue’s fork.

ilfelice’s picture

Howdy,

I tried running the same site I am having problems with to PHP 7 (currently PHP 5.6), to see if it was PHP related.

Unfortunately, it made no difference. :(

Just FYI.

paulocs’s picture

Hey jorgemare,
My solution for my case was that the hook_field_extra_fields was called two times in different modules and both were adding the weight for the same element. And as the issue description says, the module_invoke_all has an array_merge_recursive inside the function.

The "problem" was in the hook_field_extra_fields in the i18n module and in a custom module that I have in my project.
Maybe the problem in you project isn't in the Bootstrap fieldgroup module.

jrochate’s picture

In my case I had to do a similar change on field_group/field_group.module on line 451:

'instance_settings' => array()

With both changes, there is no more AJAX error.

ilfelice’s picture

Hi jrochate!

That did the trick! Thank you so much!

  • aritrika.d authored bcad35d on 7.x-1.x
    Issue #3191992 by aritrika.d, pinueve: Error: Unsupported operand types...
cha0s’s picture

Status: Reviewed & tested by the community » Fixed

Thank you! It's been committed to the dev branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.