If I override a node view using panels, the content moderation block is not shown. That makes it difficult to see the current status of the node you are editing. But why is it not rendering. It works on all nodes not overridden by panels.

I did not see that the view mode was page_manager when debugging the code, is that a custom view mode you made?

This issue seems to be a duplicate of this one, which I think has a better solution: https://www.drupal.org/node/1357788.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lsolesen’s picture

Title: Add content pane for moderation status » Workbench information block is not shown when added in panels node_view
Project: Workbench Moderation » Panels
Version: 7.x-1.1 » 7.x-3.0-alpha3
Category: feature » support

I am able to put in the workbench moderation block on the node view panel. The block is just not shown when I am logged in to my site, so I am moving this issue to panels. I have the proper permissions and on all nodes which I have not overridden by panels, the block is showing.

I have the following panel

$handler = new stdClass;
$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
$handler->api_version = 1;
$handler->name = 'node_view_panel_context_2';
$handler->task = 'node_view';
$handler->subtask = '';
$handler->handler = 'panel_context';
$handler->weight = 1;
$handler->conf = array(
  'title' => 'Subjects',
  'no_blocks' => 0,
  'pipeline' => 'standard',
  'css_id' => '',
  'css' => '',
  'contexts' => array(),
  'relationships' => array(),
  'access' => array(
    'plugins' => array(
      0 => array(
        'name' => 'node_type',
        'settings' => array(
          'type' => array(
            'subject' => 'subject',
          ),
        ),
        'context' => 'argument_entity_id:node_1',
        'not' => FALSE,
      ),
    ),
    'logic' => 'and',
  ),
);
$display = new panels_display;
$display->layout = 'twocol_stacked';
$display->layout_settings = array(
  'items' => array(
    'canvas' => array(
      'type' => 'row',
      'contains' => 'column',
      'children' => array(
        0 => 'main',
      ),
      'parent' => NULL,
    ),
    'main' => array(
      'type' => 'column',
      'width' => 100,
      'width_type' => '%',
      'children' => array(
        0 => 2,
        1 => 'main-row',
        2 => 7,
      ),
      'parent' => 'canvas',
    ),
    'main-row' => array(
      'type' => 'row',
      'contains' => 'region',
      'children' => array(
        0 => 'center',
      ),
      'parent' => 'main',
    ),
    'center' => array(
      'type' => 'region',
      'title' => 'Video',
      'width' => 100,
      'width_type' => '%',
      'parent' => 'main-row',
      'class' => '',
    ),
    2 => array(
      'type' => 'row',
      'contains' => 'column',
      'children' => array(
        0 => 3,
        1 => 4,
      ),
      'parent' => 'main',
      'class' => '',
    ),
    3 => array(
      'type' => 'column',
      'width' => 50,
      'width_type' => '%',
      'parent' => '2',
      'children' => array(
        0 => 6,
      ),
      'class' => '',
    ),
    4 => array(
      'type' => 'column',
      'width' => 50,
      'width_type' => '%',
      'parent' => '2',
      'children' => array(
        0 => 5,
      ),
      'class' => '',
    ),
    5 => array(
      'type' => 'row',
      'contains' => 'region',
      'children' => array(
        0 => 'introduction',
      ),
      'parent' => '4',
      'class' => '',
    ),
    6 => array(
      'type' => 'row',
      'contains' => 'region',
      'children' => array(
        0 => 'picture',
      ),
      'parent' => '3',
      'class' => '',
    ),
    'picture' => array(
      'type' => 'region',
      'title' => 'Picture',
      'width' => 100,
      'width_type' => '%',
      'parent' => '6',
      'class' => '',
    ),
    'introduction' => array(
      'type' => 'region',
      'title' => 'Introduction',
      'width' => 100,
      'width_type' => '%',
      'parent' => '5',
      'class' => '',
    ),
    7 => array(
      'type' => 'row',
      'contains' => 'region',
      'children' => array(
        0 => 'information',
      ),
      'parent' => 'main',
      'class' => '',
    ),
    'information' => array(
      'type' => 'region',
      'title' => 'Information',
      'width' => 100,
      'width_type' => '%',
      'parent' => '7',
      'class' => '',
    ),
  ),
);
$display->panel_settings = array();
$display->cache = array();
$display->title = '';
$display->content = array();
$display->panels = array();
  $pane = new stdClass;
  $pane->pid = 'new-1';
  $pane->panel = 'bottom';
  $pane->type = 'entity_field';
  $pane->subtype = 'node:field_subject_video';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'label' => 'hidden',
    'formatter' => 'styles_media_content_width',
    'formatter_settings' => array(
      'file_view_mode' => 'file_styles_medium',
    ),
    'context' => 'argument_entity_id:node_1',
    'override_title' => 0,
    'override_title_text' => '',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array(
    'css_id' => '',
    'css_class' => 'video',
  );
  $pane->extras = array();
  $pane->position = 0;
  $pane->locks = '';
  $display->content['new-1'] = $pane;
  $display->panels['bottom'][0] = 'new-1';
  $pane = new stdClass;
  $pane->pid = 'new-2';
  $pane->panel = 'bottom';
  $pane->type = 'entity_field';
  $pane->subtype = 'node:body';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'label' => 'above',
    'formatter' => 'text_default',
    'formatter_settings' => array(),
    'context' => 'argument_entity_id:node_1',
    'override_title' => 0,
    'override_title_text' => '%title %node:title',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array();
  $pane->extras = array();
  $pane->position = 1;
  $pane->locks = '';
  $display->content['new-2'] = $pane;
  $display->panels['bottom'][1] = 'new-2';
  $pane = new stdClass;
  $pane->pid = 'new-3';
  $pane->panel = 'bottom';
  $pane->type = 'views';
  $pane->subtype = 'employees_context';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'override_pager_settings' => 0,
    'use_pager' => 0,
    'nodes_per_page' => '50',
    'pager_id' => '0',
    'offset' => '0',
    'more_link' => 0,
    'feed_icons' => 0,
    'panel_args' => 0,
    'link_to_view' => 0,
    'args' => '',
    'url' => '',
    'display' => 'block_1',
    'context' => array(
      0 => '',
    ),
    'override_title' => 1,
    'override_title_text' => 'Undervisere',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array();
  $pane->extras = array();
  $pane->position = 2;
  $pane->locks = array();
  $display->content['new-3'] = $pane;
  $display->panels['bottom'][2] = 'new-3';
  $pane = new stdClass;
  $pane->pid = 'new-4';
  $pane->panel = 'left';
  $pane->type = 'entity_field';
  $pane->subtype = 'node:field_picture';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'label' => 'hidden',
    'formatter' => 'image',
    'formatter_settings' => array(
      'image_style' => 'sidepicture',
      'image_link' => '',
    ),
    'context' => 'argument_entity_id:node_1',
    'override_title' => 0,
    'override_title_text' => '',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array();
  $pane->extras = array();
  $pane->position = 0;
  $pane->locks = '';
  $display->content['new-4'] = $pane;
  $display->panels['left'][0] = 'new-4';
  $pane = new stdClass;
  $pane->pid = 'new-5';
  $pane->panel = 'right';
  $pane->type = 'entity_field';
  $pane->subtype = 'node:field_subject_teaser';
  $pane->shown = TRUE;
  $pane->access = array();
  $pane->configuration = array(
    'label' => 'hidden',
    'formatter' => 'text_default',
    'formatter_settings' => array(),
    'context' => 'argument_entity_id:node_1',
    'override_title' => 0,
    'override_title_text' => '',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array();
  $pane->extras = array();
  $pane->position = 0;
  $pane->locks = '';
  $display->content['new-5'] = $pane;
  $display->panels['right'][0] = 'new-5';
  $pane = new stdClass;
  $pane->pid = 'new-6';
  $pane->panel = 'top';
  $pane->type = 'block';
  $pane->subtype = 'workbench-block';
  $pane->shown = TRUE;
  $pane->access = array(
    'plugins' => array(
      0 => array(
        'name' => 'perm',
        'settings' => array(
          'perm' => 'view moderation messages',
        ),
        'context' => 'logged-in-user',
        'not' => FALSE,
      ),
    ),
  );
  $pane->configuration = array(
    'override_title' => 0,
    'override_title_text' => '',
  );
  $pane->cache = array();
  $pane->style = array();
  $pane->css = array();
  $pane->extras = array();
  $pane->position = 0;
  $pane->locks = array();
  $display->content['new-6'] = $pane;
  $display->panels['top'][0] = 'new-6';
$display->hide_title = PANELS_TITLE_FIXED;
$display->title_pane = '0';
$handler->conf['display'] = $display;
lsolesen’s picture

Project: Panels » Workbench Moderation
Version: 7.x-3.0-alpha3 » 7.x-1.1

This is probably a workbench moderation issue?

lsolesen’s picture

Category: support » bug
Taxoman’s picture

Version: 7.x-1.1 » 7.x-1.x-dev

Is this also a problem in 2.x? (then it should be moved into that queue)

Taxoman’s picture

Issue summary: View changes

More precise desccription

dsnopek’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
639 bytes

It's really matter of the information in "Workbench information" never getting populated because workbench_moderation_node_view() only populates it on $view_mode == 'full', but when overriding the node view with Panels the $view_mode == 'page_manager'. Here is a patch to fix it!

mvc’s picture

Status: Needs review » Reviewed & tested by the community

Patch in #5 works for me.

KarlShea’s picture

Patch in #5 also works for me.

I'm not sure why the view mode needs to be checked at all? This is the original code:

if (node_is_page($node) && $view_mode == 'full' && empty($node->in_preview))

The docs for node_is_page() say:

Returns whether the current page is the full page view of the passed-in node.

So what is checking the view mode trying to accomplish? Couldn't it just be left out altogether?

mortona2k’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
FileSize
639 bytes

My node uses a custom view mode, but the workbench information block isn't showing up with this patch. For the line that it's changing, my node object has my custom view mode, not page_manager.

I'm not sure why the block visibility should be controlled in this code vs the block settings?

mortona2k’s picture

Issue summary: View changes

I realized that my workbench info is showing the status of the last node rendered on the page, not the node that the page is for. Maybe the logic assumes there is only one node rendered with full view mode?

mortona2k’s picture

Issue summary: View changes
kiwimind’s picture

We've recently found the same issue. Unlike some of the other comments here though, ours was caused by an upgrade to contextual view modes while using a custom view mode instead of the default 'full' view mode.

I thought I'd update this thread rather than the one linked to in the initial comment as it seems to be more active and hopefully a wider audience than just panels users.

Rather than trying to tackle this to cover a single base, please find attached a patch that allows this to be overcome using variables, so that there are several ways of getting this to work:

1. Set the variable using drush
2. Set the variable in a custom module
3. Use settings to set the variable

I hope that this helps.

Thanks.

kiwimind’s picture

Status: Needs work » Needs review
ron_s’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#1357788: 'Workbench information' doesn't show on panels 'Node template' page

I think both this patch (#11) and the one in #1357788 are of value. It really depends on what you need to accomplish.

The value of this patch is it allows for the block to be configured outside of Panels. We want staff to have the ability to move, add, and replace panel panes, but Workbench Information is one that we do not want them to remove or move.

By configuring it above the content area in the Blocks, and limiting access to the block configuration, it meets our needs.

The other patch in #1357788 is a more modular solution in that it creates a new panel pane rather than relying on a panels-enabled block. If you want to be able to configure and move the pane in page manager, this is the way to go.

I'm marking both of these as reviewed.