You are here

public function EditTab::getTitle in Workbench Moderation 8.2

Same name and namespace in other branches
  1. 8 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 80

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() {
  if (!$this->moderationInfo
    ->isModeratableEntity($this->entity)) {

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

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