We have a very strange problem with the latest version of ctools.
Steps to reproduce:
- Install Drupal 7 minimal
- Activate Field UI, Panels, Display Suite, Display Suite UI and Page manager.
- Create a content type with a extra text field
- Manage Display and activate "Two column" display for default and have body-field left and extra text field right
- Create one node and enter some data
- Verify that /node/1 is displayed in two columns
- Activate Paga manger "/node/%node" at /admin/structure/pages
- Create a variant with one variant and layout one column
- Verify bug at /node/1. Fields are not longer in two column
This happens because /sites/all/modules/ds/layouts/ds_2col/ds_2col.css is not loaded. Generated code is okay.
A variant of this is to create a custom page at page manager and load the node. This time the css is loaded and it looks okay.
This has happen between ctools-1.5 and ctools-1.6. It doesn't matter version of panels and display suite.
Work around
Add css code from ds_2col.css in your theme.
Comments
Comment #1
kristofferwiklund commentedRunning git bisect gives this error commit:
05d7202ef562b90fa1cf8c541ac3ef0b35077613 is the first bad commit
commit 05d7202ef562b90fa1cf8c541ac3ef0b35077613
Author: meba
Date: Sat Jan 17 13:52:01 2015 -0800
Issue #1760384 by DamienMcKenna, meba: Update node_view.inc to execute the normal Drupal hooks
:040000 040000 2e86453ee59bb775aeea2ecef7a7e8e3ec0eafde 66b6522deb8f83523fd3b56e86a56311756e750a M page_manager
Comment #2
kristofferwiklund commentedComment #3
kristofferwiklund commentedAfter some reading in #1760384-40: Update node_view.inc to execute the normal Drupal hooks
If I in page_manager/plugins/tasks/node_view.inc and function page_manager_node_view_page($node)
move $default_output = node_page_view($node); to the last rows this solves the problem.
But previous commit was done for it to run. But loading the node twice break some functionality.
Comment #4
teknocat commentedHere is a patch.
Comment #5
stborchertAfter doing the latest security update we also ran into this problem.
I've updated the patch and moved the comment for the changed code.
Comment #6
cyberschorschThe patch #5 is working for me :)
Comment #7
japerryWorks for me too. Committed!
Comment #10
ruloweb commentedI thinks this commit needs to be reverted.
Moving node_page_view() at the end only prevents that function to be called when page manager is active for node_view, how that can solve the issue?
Has this resolution been arrived by accident? or is there any explanation?
Some modules add js and css files to the content array theme $node->content['#attached']. It is proccesed on drupal_render (https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_...), so we just need to call this function. There is not a problem if it's called again, because it does a check on the #printed element to prevent more than one call.
I reversed this commit (git revert e18e4acc63bae99ffc2ecc7ace13cdace8936084) and applied the patch attached an it solves the display suite issue and others issues related with JS files (statistics ajax).
Thanks for opening this issue!
Comment #11
ruloweb commentedComment #12
joelpittetdrupal_render() expects a reference. You need to separate the two function calls for this to work.
Comment #13
ruloweb commentedThanks @joelpittet, attached is the new patch.
Comment #14
joelpittetThanks that should work, not sure if the solution is correct but let people mull over your explanation in #10
Comment #15
damienmckennaCan someone please test if this is fixed by #2422123: should entity view hooks be triggered unconditionally in node_view, term_view and user_view pages??
Comment #16
rjacobs commentedIn response to #15, it looks like the commit in this issue (#8) introduces a regression that re-opens #1760384: Update node_view.inc to execute the normal Drupal hooks. That is tangled with #2422123: should entity view hooks be triggered unconditionally in node_view, term_view and user_view pages? as #2422123 is basically a follow-up to #1760384.
It's actually quite possible that this issue is a dup of #2422123: should entity view hooks be triggered unconditionally in node_view, term_view and user_view pages?, and that the problems described are related to the fact that node build/rendering (including view hook invocation) can happen redundantly in certain situations. I can't be 100% sure of that though. Issue #2422123 is trying to fix all that while still preserving the functionality introduced in #1760384.
I'm marking as "needs work" due to this, but the right status may actually be "postponed" until #2422123: should entity view hooks be triggered unconditionally in node_view, term_view and user_view pages? gets resolved (and someone can verify if this even still applies then).
Comment #17
sylus commentedI think this issue might needs to be looked at again as it caused my following behat test to fail but as soon as I went one commit before it started to work again.
Comment #18
sylus commentedHere is a patch for drush make purposes to roll back this commit on top of 1.9.
Comment #19
mthomas commentedThe code committed to 7.x-1.9, sha e18e4acc introduces a regression for me. I'm using a custom content pane with substitution like %node:field_image. This works when the image has a value other than the default, but the default value doesn't show up when the original patch is applied. Suggest reverting this patch in the next stable version of ctools.
Comment #20
becw commentedThe change related to this issue (commit
e18e4a) introduces a regression for me, too. I have a site that uses Panelizer and Mini Panels to configure node layouts. The node titles are rendered in the node body (rather than at the page level) so I use the"Node" Titlepane in the panelizer panel configurations. When I updated CTools from 7.x-1.7 to 7.x-1.9, I found that the"Node" Titlepanes (which should have contained the node title) were empty.Comment #21
becw commentedHere's a simple patch that reverts the change.
Comment #22
ruloweb commentedHere's a patch which reverts the change like #21 and apply the fix explained in #10
It applies on 7.x-1.9 and last dev.
Thanks!
Comment #24
sergeimalyshev commentedPatch #22 works fine - displays defaulted image field and doesn't break Google map in other field.
Comment #25
sergeimalyshev commentedOnly problems with caсhing..
Comment #26
anahawk commentedYou may want to be careful with the extra drupal_render though (as in #22) - I'm using a node template override to render forums, and this causes the Advanced Forum comment preprocess to get called twice, which messes up comment counts.
That said, I'm not using Display Suite, just came here looking for a way to hook into node links - which works perfectly well by moving the node_page_view to the top, as it's done in #22.
Comment #27
ruloweb commentedComment #28
crutch commented#22 fixed the issue for us
Comment #29
minoroffense commentedI think there's a problem with this patch. I think the node hooks are being double invoked which causes some weird behavior (most notably with comments). If you render a node with the comments and comment form onto a page using Page Manager with the node_view page and have more than one page of comments, the pager stops working. You can only ever view the first page of comments. If you add "page=1,1" as if two pagers had been rendered the next page of comments can be viewed. Also the comment form id is "--2" at the end implying that Drupal has rendered that HTML element with that ID already at some point.
Rendering the node through page view arbitrarily at the top of the function seems to break stuff. The solution in #2422123: should entity view hooks be triggered unconditionally in node_view, term_view and user_view pages? to have node_page_view be called as a fallback works better (we aren't double invoking the node hooks).
I haven't tested things extensively yet but I can confirm that when we remove:
the comment pager and comment form work normally again.
Comment #30
rivimeyI'm trying to help japerry get ctools-1.11 out the door.
Something related to this issue appears to be related to: https://www.drupal.org/node/2556253
The git commit is below. The patch in 2556253 is essentially a revert of this commit. Can anyone comment on what this was trying to achieve and whether the revert is acceptable?
Comment #31
alesr commentedI think this issue needs some attention.
We all know the patch that was accepted caused a huge regression issue.
Same here: https://www.drupal.org/project/ctools/issues/2556253#comment-12510438
Is this going to be fixed at all?
@joelpittet @japerry
Comment #35
joelpittetThe patch needs a reroll, and #29 concerns with the patch should be addressed.
It may be worth adding a regression test to prevent future issues as well.
Comment #36
natew commentedre-roll patch in #22 against latest
Comment #37
crutch commented#36 fixes the issue again for us with regard to default image.
Default images where working with #22. However, we did encounter css/js issues creating panel pages with #22.
Comment #38
idmacdonald commented#36 fixes the issues that we were having with added JS not being loaded.
Comment #39
japerryDrupal 7 is no longer supported, closing.