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.
The default panels configuration for advanced forums has 3 variants.
The forum variant to show a single forum also includes content to show a list of the other forums.
For some reason this forum list does not show on the front end.
Any hints on how to fix this?
Comments
Comment #1
inventlogic CreditAttribution: inventlogic commentedI had to add the Forum context in Contexts with identifier:Forum and keyword:forum.
This is because in the file forum_list.inc under modules/advanced_forum/plugins/content_types
The following plugin array is declared with the array element
'required context' => new ctools_context_required(t('Forum'), 'forum')
The "required context" element arguments mean that the forums list will only show if there is a context with the Identifier: Forum and keyword:forum.
There is already a default context with this exact setup but the name of the context is "Argument 1"
Whereas the name of the new context I created is "Context 1" which works and lets the forum list display.
Is this the expected behavior or is the "Argument 1" context misnamed?
Comment #2
troky CreditAttribution: troky commentedCan you provide exact steps to reproduce this error?
Comment #3
troky CreditAttribution: troky commentedNo response. Closing.
Comment #4
ron_s CreditAttribution: ron_s commentedI can confirm there is a bug, and can consistently reproduce the error.
Somewhere in the advanced_forum code it is losing the relationship with the required context. I've tried to compare this module to how Ctools adds the node context, or how Workbench uses the node context to create a required context for the workbench_display plugin. I cannot find what the difference is, but there is definitely one that exists.
As mentioned by @inventlogic, adding "Context 1" with a name of "Forum" and ID of "forum" fixes the problem.
How to reproduce:
In our case, we're using the Authcache module to perform authenticated user caching. If advanced_forum is accessed as an admin user without authcache, the panels render correctly. The problem occurs when viewing the page as a user with an cached role. We do not see this type of context issue with any other entity (nodes, blocks, ctools panes, fieldable panels panes, etc.).
Install and configure a basic authcache setup. I'm sure this problem will exist if just using the builtin options. Configure caching for the "forum_statistics" plugin pane so it is cached and refreshes every 5 minutes. Test loading "/forum" with a user who has a role delivering cached pages. When authcache does its callback to render the pane, nothing is displayed.
If I comment out
'required context' => new ctools_context_required(t('Forum'), 'forum')
from the plugin, I can get the pane to render static text, but with errors. Not until I add another Context for the variant does it start to display correctly. So it's clear the required context is the heart of the problem.Wondering if there might be an issue in a function like
hook_default_page_manager_handlers
? I was comparing this function to how it is used in the Panelizer module, and they actually define the context directly in the $handler object:I tried doing something similar to this in advanced_forum and did not seem to help. Somewhere there is a missing connection and the context is no longer recognized.