Problem/Motivation

The following notice appears:
Notice: Trying to access array offset on value of type null in ctools_entity_form_field_content_type_admin_title() (line 164 of ctools/plugins/content_types/form/entity_form_field.inc).

Steps to reproduce

  1. Edit a panel node edit page content with field groups e.g. /admin/structure/pages/nojs/operation/node_edit/handlers/node_edit__panel_context/content
  2. Observer the above notice

Proposed resolution

As field_info_instance() doesn't work for field groups use field_group_info_groups() instead.

Remaining tasks

  1. Review and commit

User interface changes

  • Field groups now have labels
  • Associated PHP notice no longer appears

API changes

  • None

Data model changes

  • None

Issue fork ctools-3213534

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

MustangGB created an issue. See original summary.

mustanggb’s picture

Status: Active » Needs review
wylbur’s picture

Issue tags: +PHP 7.4
joelpittet’s picture

@MustangGB, why not take care of this case in field_group module? Or a generic way that doesn't tie it to field_group module so closely.

mustanggb’s picture

@joelpittet

The reason being that ctools already has field_group specific code that is pretty much exactly the same thing as my code in other areas of the module, see #2222513: Provide Field Group panes for entity edit forms.

So it seems to make more sense and is easier to add a few lines of code here that are consistent with the existing code than to rip out existing code and re-write field_group to behave as a fake field, or however you'd need to do it.

Or in other words, this was missed from the original commit in #2222513: Provide Field Group panes for entity edit forms, but no-one bother to look at fixing it until it started producing notices.

joelpittet’s picture

Status: Needs review » Needs work

@MustangGB thanks for the context, there is a minor new notice potential in the code, I commented. I'll commit once that is resolved.
For reference: https://3v4l.org/c3o8K

mustanggb’s picture

Something like this?

joelpittet’s picture

Status: Needs work » Fixed

Thanks @MustangGB that seems like a reasonable default, I've merged, and issue credit is apparently a thing with merging... but it got you as the author so at least that worked.

mustanggb’s picture

Thanks.

Status: Fixed » Closed (fixed)

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