Hi there!
On 8.x-3.0-rc1 I got this notice:
Notice: Undefined property: stdClass::$region in field_group_form_process() (line 318 of modules/contrib/field_group/field_group.module).
After looking into this method, I found that on the following line it is assumed the region property is set:
$group_parents[] = empty($group->parent_name) ? $group->region : $group->parent_name;
I don't know if the above is actually correct or if $group->region should be replaced with $group->parent_name since that one is being checked on being empty() or not.
I've also related https://www.drupal.org/project/field_group/issues/3054195 to this issue since it's probably coming from a same kind of situation.
Comments
Comment #2
seanbIt seems this should have been fixed by
field_group_update_8301(). Have you tried the latest dev version and run all database updates after updating the module?Comment #3
brianV commentedI've encountered this issue as well after updating from 8.x-1.0-rc6 to 8.x-3.0-rc1. It appears that
field_group_update_8301()is not being run, as adrush updbreturns 'No database updates required' after the module update.Further more, executing
drush ev "echo drupal_get_installed_schema_version('field_group');"returns-1(ie.,SCHEMA_UNINSTALLED), indicating that the schema is not installed.If I manually set the schema version to 8000 with
drush ev "drupal_set_installed_schema_version('field_group', 8000);", the updates then run properly, and theNotice: Undefined property: stdClass::$region in field_group_form_process() (line 318 of modules/contrib/field_group/field_group.module).disappears.Is it possible that earlier versions of the 8.x-1.x series did not have their schema version set properly upon install?
Comment #4
raghavendra b m commentedComment #5
raghavendra b m commentedComment #6
raghavendra b m commentedComment #7
raghavendra b m commentedI have added 2 patch #5 and #6. Both will work fine
Comment #8
nortmas commentedNope, the patch doesn't work for me.
Comment #9
nortmas commentedThe requirement is after you've updated the module to 8.x-3.0-rc1 you have to export configurations. If you import the old ones you run into this error.
Comment #10
ara martirosyan commented@nortmas thanks, I confirm it. So basically we can run
drush ev "drupal_set_installed_schema_version('field_group', 8000);"to set the schema version to 8000, then run
drush updatedbto make run
field_group_update_8301()and then export configs with
drush cexand commit.Comment #11
shamalainen commentedThank you Ara Martirosyan #10, it worked like a charm!
Comment #12
tmwagner commentedThank you, Ara (#10)
That fixed my issue as well.
Not sure what the line next to the last was about... it is formatted as if it were a line command... I don't think that is the case 🤔
At any rate - problem solved.
Comment #13
jj commentedwithdrawn
Comment #14
attheshow commentedAttaching updated patch that's working better for us.
Comment #15
sharif.elshobkshy commentedHi.
I'm currently using Field Group version 8.x-3.0-rc1 and encountered the same issue.
Comment #16
sharif.elshobkshy commentedHi.
I'm currently using Field Group version 8.x-3.0-rc1 and encountered the same issue.
Patches above will not work.
Those patches are only fixing the warnings triggered by the Field Group module. However, other warnings are being triggered by other modules due to this issue, and not fixed by the patches above.
(ex: Errors triggered by FieldUiTable.php (Field UI core module)).
I fixed the issue globally by executing a config export.
Steps after upgrading:
drush updb -ydrush config-import -ydrush cex -yThe config export added a "region: content" for most third party settings.
The export fixed the issue for me.
However, for those of you that only want to fix the warnings triggered by the Field Group module, attached is the propper patch.
Following the logic behind
field_group_update_8301(), region should use "content" as a default value.Hope that helps.
Regards.
Comment #17
phthlaap commentedI have the same problem with this issue. It has been resolved by run update.php
Comment #18
swentel commentedOk, closing then if the update works. Tracking some other errors in #3059614: Undefined property: stdClass::$region in field_group_form_process()
Comment #19
andrew answer commentedI ran project with Field Group 8.x-3.0-rc1, Paragraphs and Paragraphs Collection (Experimental Widget). When I open node edit form which have paragraphs, I see same error (see issue title).
Update Field Group with update hook does not fix anything because of getThirdPartyProviders is empty for all entities.
I prepared simple patch for fixing that situation. Please review.
Comment #20
swentel commentedHmm, but this means you do have field groups right? Because otherwise the function wouldn't get that far. So I'm curious how the setup is to see if we can potentially reproduce the notice.
Comment #21
andrew answer commentedI analyzed my site today and found what configuration for core.entity_form_display.node.[content type].default.yml doesn't have region key for field_group. Manually add region: content and execute drush cim. All work fine.
Comment #22
andrew answer commentedComment #23
swentel commented#3075264: Fix upgrade path to account for DS regions should probably fix this once at for all btw, but thanks for the check!
Comment #24
alberto56 commentedI'm still getting this.
Upgrading from field_group 1.x to 3.0,
Then running drush updb:
Then visiting an edit node with field groups, I get:
Notice: Undefined property: stdClass::$region in field_group_form_process() (line 366 of modules/contrib/field_group/field_group.module).I'll reopen this and/or [#3075264 ] and/or a new ticket if I can come up with a reason behind this, or at least steps to reproduce.
Comment #25
alberto56 commentedAs a workaround to #24, I had to manually run the code in field_group_post_update_0001().
Comment #26
swentel commentedHmm weird, I can't think of a reason why it didn't work then when running drush updb ...
Comment #27
nils.destoop commentedIdd, very weird. Could it be that you did the update, and immediately after that a config import? If so, you will reset the config again to the original value.
After the update is executed, you need to do a config export to save those changes also to the config files.
Comment #28
ressaI am also seeing the "Notice: Undefined property: stdClass::$region ..." error as well as parent groups getting moved down to "Disabled". I'd like to try to manually run the update, could you kindly share a way of doing that @alberto56?
Comment #29
alberto56 commented@nils.destoop that's exactly it, it seems. This seems related to #3110362: If an update hook modifies configuration, then old configuration is imported, the changes made by the update hook are forever lost..
@ressa to manually run the update, here's how I did it:
Comment #30
alberto56 commentedSo to summarize how I fixed this in case anyone else runs into this issue:
On my dev site:
on my prod site:
Comment #31
ressaNice @alberto56, that worked perfectly, thanks for sharing!
After running the php command I got this, so I thought it didn't work, when it in fact worked fine:
It adds
region: contentunder each group instance in fxcore.entity_form_display.node.article.default.ymlunder:... and the sub-fields are nicely grouped again under their parent groups in regular and form displays.
Comment #32
jibranThis is also happening when view mode is using the layout builder.
Comment #33
jibranRerolled #19 against 3.x HEAD.
Comment #34
elfakhar commentedthis Fix Bug in core_version_requirement: ^8.8 || ^9
Comment #35
damienmckennaThe patch needs a little rework to match the Drupal coding standards - the commented-out code should be just removed, and the "else" statement needs to be on a separate line.
Comment #36
nikitagupta commentedComment #37
nikitagupta commentedComment #38
nikitagupta commentedComment #39
stephen-cox commentedPatch #37 resolved the error I was seeing on node add and edit forms when grouping fields using tabs.
Comment #40
sershevchykI had an error:
Notice: Undefined property: stdClass::$region in Drupal\field_group\FormatterHelper::formProcess() (line 76 of /app/docroot/modules/contrib/field_group/src/FormatterHelper.php)and patch #37 resolved this the error too.
Comment #41
rajeev_drupal commented#37 resolved this eror. Thanks.
Comment #42
rajeev_drupal commentedComment #43
fgmDuring a 9.0.6 upgrade, the
$display->save()in field_group_post_update_0001() still causeThe "hidden" plugin does not existexceptions, preventing the hook from succeeding.More details: when examining these form displays, all found on node types, at admin/structure/types/manage/
/form-display, there are two anomalies:
hidden.Trying to set the region back to
content, or even trying to delete the field_group, causes that same exception about thehiddenpluging not being defined.On non-node entity types with field groups, the migration succeeds and none of these problems are present.
Similary, when adding a field_group to a form display of an entity type which had none, if the entity type is node, the same exception appears, but it does not appear on other entity types.
Comment #44
fgmFound the underlying cause: the NodeStorageSchema on that site was not default, and was still defining type=>hidden on an extra "weight" base field.
The post_update hook could have detected use of this now-inconsistent definition and emitted a more usable error. Probably not have fixed it on its own, this being outside its own job defining field groups. But it is not necessarily a blocker for the patch, so resetting to RTBC.
Comment #45
acbramley commentedI had the same issue, manually running the post update hook and exporting config fixed it for me.
Comment #46
gustavowal commentedPatch #37 works here, Drupal 8.9.x.
Comment #47
aiphesHello,
Facing this notice too. v 8.x.3.1
Notice : Undefined property: stdClass::$region dans Drupal\field_group\FormatterHelper::formProcess() (/home/xx/www/xx/sited8/modules/contrib/field_group/src/FormatterHelper.php ligne 76)Will try the patch to see it fix it.
Comment #48
attheshow commentedAdding an updated patch since the previous one was no longer applying cleanly.
Comment #49
kim.pepperComment #50
marioheber commentedHello!
On 8.x-3.0-rc1 I got this notice:
Patch #48 works here, Drupal 9.2.x
Comment #51
baikho commented#48 works, thank you.
Comment #52
gngn commented#37 works for us.
@attheshow in #48
#37 and #48 look exactly the same to me...
Comment #53
dpacassi#48 has been working on a project of mine for months now, +1 ready to be committed
Comment #55
swentel commentedcommitted and pushed, thanks all.
Comment #56
swentel commentedComment #57
jakegibs617 commented#48 and #37 are no longer working for me having upgraded to d10. "drupal/field_group": "^3.4"
looks like the code is now in the new version so we don't need the patch anymore. Can someone confirm?