Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Have not found the source yet, but the changes made to metatag_panels in 7.x-1.26 are throwing lots of watchdog errors:
Warning: Invalid argument supplied for foreach() in element_children() (line 6719 of /app/includes/common.inc).
Warning: Illegal string offset '#children' in drupal_render() (line 6176 of /app/includes/common.inc).
Warning: Illegal string offset '#children' in drupal_render() (line 6186 of /app/includes/common.inc).
Warning: Illegal string offset '#children' in drupal_render() (line 6224 of /app/includes/common.inc).
Warning: Illegal string offset '#printed' in drupal_render() (line 6231 of /app/includes/common.inc).
Warning: Invalid argument supplied for foreach() in element_children() (line 6719 of /app/includes/common.inc).
etc...
Most likely something in the $elements
is now empty that shouldn't be.
These errors do not exist in 7.x-1.25, and disabling Metatag integration for any panels page fixes the issue.
Comments
Comment #2
ron_s CreditAttribution: ron_s commentedI'm noticing that metatag_panels has somehow lost part of the context. The token for
[current-page:title]
is returning an empty value if title type for the panel variant is set to "From pane". If it is changed to "Manually set", it picks up the value.Comment #3
ron_s CreditAttribution: ron_s commentedComment #4
ron_s CreditAttribution: ron_s commentedRolling back the patch committed as part of 7.x-1.26 for Issue #3037874 fixes the problem.
Issue: https://www.drupal.org/node/3037874
Commit: https://git.drupalcode.org/project/metatag/commit/e0b1e98
By moving the metatags for panels to later in the process, it causes contexts to not be available and returns empty elements when using the "From pane" option for setting the panel page title.
Comment #5
ron_s CreditAttribution: ron_s commentedComment #7
DamienMcKennaDarn :-\
I'm going to reopen the original issue and revert the change.
Comment #8
DamienMcKennaComment #10
Ronino CreditAttribution: Ronino as a volunteer commented@ron_s wrote:
I'd like to fix this but I cannot reproduce these errors. What are the exact steps?
Patch #8 in #3037874: Build meta tags for panels much later like metatag and metatag_views do so they can be altered after page data has been processed might already fix this though.
Comment #11
ron_s CreditAttribution: ron_s commented@Ronino, I'm assuming you were testing with 7.x-1.26 or a -dev version that included this code? The latest version had rolled back this patch.
The exact steps are as follows:
1) Create a custom pane in code that renders a block. In our case, we're pulling a "blog title" value set in a custom user account field.
2) Create a custom Panels page. In our case, it's a page called "Blog posts". Set path as "blogs/%uid".
3) Include %uid as the position 1 argument. This allows for the user context to be added to variants.
4) Add a Panels variant to the custom page.
5) Add the custom Panels pane created in step #1 to the variant's Content sub-tab.
6) Click the gear icon for the added Panels pane, and set it to be "Panel title".
7) Choose "Title type" to be "From pane".
8) Save Panels page, load, and you'll see errors in watchdog.
Let me know if you have further questions.
Comment #12
ron_s CreditAttribution: ron_s commentedI should also mention, obviously this Panels page also has Metatag configuration enabled in the variant. That's where the conflict arises.