Page manager (PM) allows overriding the node view. This patch adds a view plugin style that allows rendering the node using PM.

It still has a TODO, about showing a warning to the user if node view override isn't active, but I set it to needs review, to make sure this is the right track.

Comments

amitaibu’s picture

StatusFileSize
new8.18 KB

Add missing handler in cases views has a pager.

merlinofchaos’s picture

Doesn't the panels_teasers module more or less already do this?

amitaibu’s picture

> Doesn't the panels_teasers module more or less already do this?

I Didn't know about this module. Apart of a wsod #867266: Error: Call to undefined function panels_display_get_title() in ...\sites\all\modules\panels_teasers\panels_teasers.module seems to be fine. However I think that maybe the correct approach should be allowing Views to be aware to page_manager - which might save us some lines of code, and have something like this (node.views.inc):

/**
 * Template helper for theme_views_view_row_node
 */
function template_preprocess_views_view_row_node(&$vars) {
   // ...

  $node = node_load($nid);

  if (empty($node)) {
    return;
  }

  $node->build_mode = ($options['build_mode'] == 'teaser' || $options['build_mode'] == 'full') ? NODE_BUILD_NORMAL : $options['build_mode'];

  if(module_exists('page_manager')) {
    // Include the node_view task.
    page_manager_get_task('node_view');
   $vars['node'] = page_manager_node_view($node);
  }
  else {
    // Rest of the code ...
  }
}

The advantage is that users can create pages for teaser/ full view, and Views will be aware of that.

japerry’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Closing this issue as outdated as Drupal 6 ctools is not supported. If this issue is relevant for Drupal 7, feel free to re-open and mark for Drupal 7 (or 8)