Hi, I am using latest VIEWS, PANELS, DS and CTOOLS. First I want to say that I love Display Suite, thanks for building it!

Now my usecase:
I have added a custom DS view mode: apartments. I try to get to this DS view mode from a specific node, and when I click on manage display, it leads me to the right custom view mode. But when I look at the fields shown, it shows the full content view mode.
So for this node particular build apartments view mode is somehow overriden by the default full content view mode.
Setting the view mode in the node-edit form is not bringing me there..

Thanks a lot in advance for going into this!
Greetings, Martijn

Comments

swentel’s picture

Status: Active » Postponed (maintainer needs more info)

Do you mean setting a node view mode per node on the node form alter ? I'm not exactly following what you're trying to achieve here.

swentel’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Cleanup up the queue

Summit’s picture

Status: Closed (fixed) » Active

Hi,
Sorry for long time not responding, I was on long travel.
I am trying to achieve that one specific node shows the fields of one specific viewmode.
Right now when I choose a specific view mode (apartments) on a specific node, it is not shown.

The node shows the view mode which is chosen for all nodes for this nodetype.

Greetings, Martijn

swentel’s picture

Issue tags: +RC blocker

Alright I'll have a look at this and try to fix it for the upcoming release - If I can reproduce since I've not been able to right now, but I'll try again :)

swentel’s picture

Status: Active » Closed (cannot reproduce)
Issue tags: -RC blocker

We've been trying to reproduce this with 3 people at the sprint and this works fine, so absolutely not sure what's going on.

Summit’s picture

ok, will check it out with the newest dev's of all modules. When I do not respond everything is fine, otherwise I will respond here with usecase and settings, ok?
thanks for the effort! Greetings, Martijn

RowboTony’s picture

Version: 7.x-2.x-dev » 7.x-2.2

I encountered this issue today. I don't know why it is occurring, but I do know how and under what conditions. I am using DS with the latest NodeStream 7.x-2.0-rc4 distribution. And, for whatever reason, when the Panels node template /node/%node is enabled - my DS view mode per node settings don't work, as soon as I disabled the panels Node template the DS template works... I've fiddled around with context rules, and even disabled the "Page" variant of the Node template (as this particular use case is for a Page), but even when that is disabled, and the Node panelizer settings are excluding the node path specifically - the DS view mode does not work. Only when the entire /node/%node Node template is disabled will my custom DS view mode work. Hope that helps anyone else who may encounter this issue.

mrP’s picture

Title: Specific node override to custom DS view mode not working » Specific node override to custom DS view mode not working with panels node template enabled
Version: 7.x-2.2 » 7.x-2.6
Issue summary: View changes
Status: Closed (cannot reproduce) » Active

Same issue as #7

Diane Bryan’s picture

If the maintainers want to see a site where this problem is happening, let me know. I'm developing on Pantheon, and the live version of the site just developed the "you are getting the full-content view mode now" bug, while (so far) the test version of the site is nearly properly displaying the view mode assigned to each node.

It's under very active development, so get back to me soon.

d

fhelms’s picture

i can confirm #7

once the /node/%node panel page is enabled -
the custom view mode assigned on an individual node will be overwritten with the full-view mode.

kopeboy’s picture

Priority: Normal » Major

I can confirm #7 and I have a similar issue as well:

when Node add/edit form is enabled in Panels and DS layout is used in the edit form (Manage fields) of the content type, the fields placed in the "Hidden" region won't be hidden but visible.

In the panel I included the default Node add/edit form, I mean all of it, not choosing the single fields.

EDIT: the DS layout won't apply at all. Panels is building the base form. Even if I apply the DS 2 columns layout in Manage Fields, the default layout will apply.

Is this possible to make DS form work within Panels when using the "Node general form" as the pane?

rcodina’s picture

I can also confirm #7 If I disable Node template override made by panels the feature gets restored.

rcodina’s picture

A workaraound I'm using is just this module: https://www.drupal.org/project/contextual_view_modes

nimbfire’s picture

I am facing the same issue. Digging via backtrace I've found:

The normal invocation of a node via panels is, the one that works as desired:

20: mymodule_node_view() (Array, 2 elements)
19: call_user_func_array() (Array, 1 element)
18: module_invoke_all() (Array, 2 elements)
17: node_build_content() (Array, 2 elements)
16: node_view() (Array, 2 elements)
15: ctools_node_content_type_render() (Array, 2 elements)
14: ctools_content_render() (Array, 2 elements)
13: panels_renderer_standard->render_pane_content() (Array, 2 elements)
12: panels_renderer_standard->render_pane() (Array, 2 elements)
11: panels_renderer_standard->render_panes() (Array, 2 elements)
10: panels_renderer_standard->render_layout() (Array, 2 elements)
9: panels_renderer_standard->render() (Array, 2 elements)
8: panels_display->render() (Array, 2 elements)
7: panels_render_display() (Array, 2 elements)
6: panels_panel_context_render() (Array, 2 elements)
5: ctools_context_handler_render_handler() (Array, 2 elements)
4: ctools_context_handler_render() (Array, 2 elements)
3: page_manager_page_execute() (Array, 2 elements)
2: call_user_func_array() (Array, 1 element)
1: menu_execute_active_handler() (Array, 2 elements)
0: main() (Array, 2 elements)

And a invocation of a panel of node/%, that is forcing 'full' as view mode :

11: mymodule_node_view() (Array, 2 elements)
10: call_user_func_array() (Array, 1 element)
9: module_invoke_all() (Array, 2 elements)
8: node_build_content() (Array, 2 elements)
7: node_view() (Array, 2 elements)
6: node_view_multiple() (Array, 2 elements)
5: node_show() (Array, 2 elements)
4: node_page_view() (Array, 2 elements)
3: page_manager_node_view_page() (Array, 2 elements)
2: call_user_func_array() (Array, 1 element)
1: menu_execute_active_handler() (Array, 2 elements)
0: main() (Array, 2 elements)

I want to point that the function node_show() is, aparently, forcing 'full' for view mode for all nodes.

function node_show($node, $message = FALSE) {
  if ($message) {
    drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))), PASS_THROUGH);
  }

  // For markup consistency with other pages, use node_view_multiple() rather than node_view().
  $nodes = node_view_multiple(array($node->nid => $node), 'full');

  // Update the history table, stating that this user viewed this node.
  node_tag_new($node);

  return $nodes;
}
nimbfire’s picture

I discovered that you can view the correctly formatted node using the Add content -> Entity -> Rendered Node. =)

aleksijohansson’s picture

I +1 this problem, but it is mentioned in the View mode per node settings "If you install the Page manager module and override the node view, Page manager will win.". Would be really good to find a solution this though.

haunted’s picture

I confirm #7, and #15 doesn't work for me.

droddis’s picture

Has anyone had any luck with this? I'm seeing the same issue but I don't have page Manager installed. I have seen strange behavior between DS and Panels before though and I'm wondering if that could be part of it. Unfortunately I'm not doing very well at troubleshooting the issue.

balapalanisamy’s picture

I have temporarily fixed this in Page Manager module with a small patch. Not sure this is the correct way as this is only specific for DS view modes with node view.

There is an issue already in ctools for page manager overrides https://www.drupal.org/node/2422123.

diff --git a/ctools/page_manager/plugins/tasks/node_view.inc b/ctools/page_manager/plugins/tasks/node_view.inc
index 89a29128..979fef3b 100644
--- a/ctools/page_manager/plugins/tasks/node_view.inc
+++ b/ctools/page_manager/plugins/tasks/node_view.inc
@@ -103,6 +103,16 @@ function page_manager_node_view_page($node) {
     }
   }
 
+  // When Display suite custom view modes are enabled and the node
+  // is not panelized, better use DS node view function.
+  // The fallback here always uses 'full' view mode.
+  if (module_exists('ds') && module_exists('ds_extras')) {
+    // Load ds_extras.pages from the node module.
+    module_load_include('inc', 'ds_extras', 'includes/ds_extras.pages');
+
+    return ds_extras_node_page_view($node);
+  }
+
   // Prepare the node to be displayed so all of the regular hooks are triggered.
   $default_output = node_page_view($node);
 

It seems the DS module is not using the hook "page_manager_override" for applying the DS view modes. So the other patch is not working. I have not checked this very well. Needs to be verified.

icampana’s picture

Hi! I was going crazy with the same issue on a site that uses page_manager and DS as well, didn't wanted to patch the module to avoid future issues so with answer from #19 and what I found on the Ctools page manager code I was able to create a hook on my custom module that allowed me to have both, Page Manager (with panels) still working and DS Custom View Mode still rendering as usual.

Should allow both modules to live together and be good neighbors

/**
 * Implements hook_page_manager_override().
 */
function administration_page_manager_override($task) {
  if (module_exists('ds') && module_exists('ds_extras') && $task == 'node_view') {
    module_load_include('inc', 'ds_extras', 'includes/ds_extras.pages');
    return 'ds_extras_node_page_view';
  }
}