In ctools_context_get_context_from_relationships()
the context passed to ctools_context_get_context_from_relationship()
is not always the context specified by the relationship. Instead if the relationship's context is not present, then the context passed to the relationship is whatever the variable $rcontexts
was last set to in the previous loops.
As a side note, it is also curious that ctools_context_get_context_from_relationship()
is always called, even though the relationship plugin specifies a required context
and that required context does not exist. This side note is possibly a point of clarification rather than a bug, but what is the purpose of required context
in the relationship plugin if the plugin always gets called regardless as to whether the context exists or not? Is it the responsibility of the relationship plugin to check that the context passed in is the correct type and not NULL? If so:
ctools_terms_from_node_context()
relationhsip plugin does not appear to check whether the context is the correct type, it makes an assumption that $context
is a node, and it returns a ctools_context_create_empty()
context when $context->data
is empty, which would be the case if $context
was NULL.ctools_context_create_empty()
context when $context
is NULL then this alters the behaviour of views panes views_content_views_panes_content_type_render()
because the context exists and is empty, rather than context not existing at all, so views arguments are determined to be an empty array rather than the default 'all' exception.Add two relationships with single contexts to a panels page and create a situation where only the first context exists e.g. for a node page:
The cause appears to be this commit: https://git.drupalcode.org/project/ctools/commit/4f4c425 from issue
#2399313: Relationship silently left out if it has optional required context β
. Previously ctools_context_get_context_from_relationship()
was never called if there was no context. After this commit, it is always called even when context is NULL (missing rather than empty).
The quick fix for passing the wrong context would be to ensure $rcontext
is unset/reset on each loop.
In addition, if the correct behaviour of relationship plugins is to return empty context when their required context is missing, then views pane handling of 'all' probably needs to be fixed to account for empty rather than no context.
Needs review
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.