If a node being displayed by a shortcode in a text field (with text formats enabled) on another node's page (ex. on node/5 if you're viewing node 7), then workbench moderation gets stuck in the implementation of hook_node_view():

function workbench_moderation_node_view($node, $view_mode = 'full') {
  // Show moderation state messages if we're on a node page.
  if (node_is_page($node) && $view_mode == 'full' && empty($node->in_preview)) {
    workbench_moderation_messages('view', $node);
  }
}

node_is_page($node) loads the node of the current page (that's node 5 in the example), and as part of node loading, it also runs the text format, which then attempts to render node 17, which then again triggers hook_node_view(), and again workbench attempts checks node_is_page($node), which loads the node of the current page again (node 5 again)... then we're stuck in a loop!

Luckily, when a node is rendered as part of another node in a shortcode, the $view_mode used is not 'full' (usually 'teaser'). So simply switching the order of the conditions in the if-statement is enough to avoid the loop! (Patch attached)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

khaled.zaidan created an issue. See original summary.

khaled.zaidan’s picture