You are here

function workbench_moderation_edit_tab_title in Workbench Moderation 7.3

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

Change the name of the node edit tab, conditionally.

  • Don't change the title if the content is not under moderation.
  • If a piece of content has a published revision and the published revision is also the current moderation revision, the "Edit" tab should be titled "Create draft".
  • If a piece of content has a published revision and the current moderation revision is a newer, or if the content has no published revision, the "Edit" tab should be titled "Edit draft".

Parameters

$node: The node being acted upon.

Return value

The title for the tab.

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

File

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

Code

function workbench_moderation_edit_tab_title($node) {

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

  // Is the latest draft published?
  $state = $node->workbench_moderation;
  if (!empty($state['published']) && $state['published']->vid == $state['current']->vid) {
    return t('New draft');
  }

  // The latest draft is not published.
  return t('Edit draft');
}