Thank you for your wonderful module.
Since yesterday (drupal update) I am getting the following error on manage display:
Warning: Undefined array key "fences_field_items_wrapper_classes" in fences_field_formatter_settings_summary_alter() (line 212 of modules/contrib/fences/fences.module).
Drupal: 8.3.16
PHP: 8.3.16
Have updated fences to 3.0.6, but error persists.
Issue fork fences-3504624
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
Comment #2
guilhomI can confirm I have the same issue on my side.
It seems to happen only when you set a "Field items Wrapper Tag". The summary presented in the Manage Display page is empty and the error mentionned by liliplanet appears.
Issue is here:
We are missing "items" for items_wrapper_tag and items_wrapper_classes in array keys.
Comment #3
anybodyThanks for the report, I'm on it!
Comment #4
anybodyRegression from #3464653: Do we miss explode() calls for fences_field_classes, fences_label_classes, fences_field_items_wrapper_classes
Comment #5
anybodyPlease check, if this fixes the issue. I assume code-wise that the wrapper attribute is still being set correctly? Otherwise, tests should have failed.
So this was only a notice, nothing really broken...?
Comment #6
anybodyComment #7
anybodyOkay maybe wasn't even a regression, but from another issue where the summary was added recently.
Comment #8
grimreaperHello,
Encountering the same problem:
- fences_field_items_wrapper_tag
- fences_field_items_wrapper_classes
I checkout the proposed changes and there are still the warnings.
Comment #9
grevil commentedWe encounter the exact same issue now. Quite annoying...
I'll have a look later on today!
Comment #11
grevil commentedYea, no idea how that got in there, but there is neither a "fences_field_wrapper_tag", nor a "fences_field_wrapper_classes" key. Instead, they are called "fences_field_items_wrapper_tag" and "fences_field_items_wrapper_classes" (as @guilhom already stated).
This was introduced through #3498432: Show fences settings in field settings summary.
EDIT: Fixed typo in the key names.
Comment #12
grevil commentedReleased 3.0.7. Sorry for the delay for such an annoying issue.
Comment #13
grimreaperConfirming the fix. Thanks!
Comment #14
liliplanet commentedThank you so much @Grevil, fixed 🌷
Comment #16
abenbowHey, this appears to still be an issue in the 3.0.7 release. I'm using 3.0.7 and still getting this error message. The fix in the issue branch (which appears to be unmerged) did fix it for me, it just isn't in any current release that I can download.
Comment #17
anybody@abenbow I think it was was released with 3.0.7 - see https://git.drupalcode.org/project/fences/-/commits/3.x
Still we can tag a new release with latest changes.
Comment #18
abenbowHey, sorry to open this back up, but I think something isn't right here.
The issue is centered on the implementation of the implementation of
fences_field_formatter_settings_summary_alter().In version 3.0.7, where this bug was ostensibly fixed, the implementation of fences.module is as follows:
fences.module, v3.0.7
In the newest release, version 3.0.8, which came out yesterday, that implementation is the same. Here it is for reference:
fences.module 3.0.8
However, in the issue branch linked to this issue (link for reference: #3504624), there is a change that, for whatever reason is not in either of these releases.
Here is what the module file looks like in this feature branch.
fences.module, issue branch fences-3504624
The key difference here is that at the end of each line in the array, there is a null coalescing operator assigning each value to the empty string.
When I manually paste the above block into my fences.module file, the error I've been receiving stops.
That error output, for reference:
This change is, as yet, unmerged. The GitLab page for this issue branch reads: "5 commits behind, 1 commit ahead of the upstream repository".
Comment #20
grevil commentedComment #26
anybody@abenbow this is the change committed here:
https://git.drupalcode.org/project/fences/-/commit/38284f8404bd59000d982...
Please read #11.
@grevil will add a MR with an isset check nevertheless to hide the warning.
Comment #27
anybodyPS: Maybe re-saving your fences settings on that page could also solve it.
Comment #28
grevil commentedI created an MR, which should fix the issue for you: https://git.drupalcode.org/project/fences/-/merge_requests/47
Although, the only cases, you're warnings can happen is if
$fencesSettings['fences_field_items_wrapper_tag']and$fencesSettings['fences_field_items_wrapper_classes']do not exist for you.@anybody what do you think? Should we merge this? In theory third party settings can be altered and removed, which would cause an error here. We are using the fallback everywhere else, so I guess it makes sense!
Comment #29
grevil commented@anybody, background:
You can always pass a fallback when using
getThirdPartySetting(which we do), but you can't do that forgetThirdPartySettings, so merging this only makes sense to conform with the rest of the code.Note, that this is the only part in the code we explicitly use "getThirdPartySettingS".
Comment #30
anybody@abenbow please first try re-saving your fences settings where the issue appears. If it solves that, that would be much better. Also agree with #28.
Comment #32
grevil commentedComment #34
anybodyMR is safe enough now, so let's merge it. #27 makes sense.