You are here

public function EditTab::getTitle in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Menu/EditTab.php \Drupal\workbench_moderation\Plugin\Menu\EditTab::getTitle()

Returns the localized title to be shown for this tab.

Subclasses may add optional arguments like NodeInterface $node = NULL that will be supplied by the ControllerResolver.

Return value

string The title of the local task.

Overrides LocalTaskDefault::getTitle

File

src/Plugin/Menu/EditTab.php, line 81

Class

EditTab
Defines a class for making the edit tab use 'Edit draft' or 'New draft'.

Namespace

Drupal\workbench_moderation\Plugin\Menu

Code

public function getTitle(Request $request = NULL) {
  if (!$this->moderationInfo
    ->isModeratableEntity($this->entity)) {

    // Moderation isn't enabled.
    return parent::getTitle($request);
  }

  // @todo write a test for this.
  return $this->moderationInfo
    ->isLiveRevision($this->entity) ? $this
    ->t('New draft') : $this
    ->t('Edit draft');
}