You are here

function workbench_moderation_view_tab_title in Workbench Moderation 7.3

Same name and namespace in other branches
  1. 7 workbench_moderation.module \workbench_moderation_view_tab_title()

Change the name of the node view tab, conditionally.

  • Don't change the title if the content is not under moderation.
  • If a piece of content has a published revision, the "View" tab should be titled "View published".
  • Otherwise, it should be titled "View draft".

Parameters

$node: The node being acted upon.

Return value

The title for the tab.

1 string reference to 'workbench_moderation_view_tab_title'
workbench_moderation_menu_alter in ./workbench_moderation.module
Implements hook_menu_alter().

File

./workbench_moderation.module, line 332
Content moderation for Workbench.

Code

function workbench_moderation_view_tab_title($node) {

  // Use the normal tab title if the node is not under moderation.
  if (!workbench_moderation_node_moderated($node)) {
    return t('View');
  }

  // Is there a published revision?
  $state = $node->workbench_moderation;
  if (!empty($state['published'])) {
    return t('View published');
  }
  return t('View draft');
}