You are here

public function EventInviteLocalTask::getTitle in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_invite/src/Plugin/Menu/LocalTask/EventInviteLocalTask.php \Drupal\social_event_invite\Plugin\Menu\LocalTask\EventInviteLocalTask::getTitle()
  2. 10.3.x modules/social_features/social_event/modules/social_event_invite/src/Plugin/Menu/LocalTask/EventInviteLocalTask.php \Drupal\social_event_invite\Plugin\Menu\LocalTask\EventInviteLocalTask::getTitle()
  3. 10.0.x modules/social_features/social_event/modules/social_event_invite/src/Plugin/Menu/LocalTask/EventInviteLocalTask.php \Drupal\social_event_invite\Plugin\Menu\LocalTask\EventInviteLocalTask::getTitle()
  4. 10.1.x modules/social_features/social_event/modules/social_event_invite/src/Plugin/Menu/LocalTask/EventInviteLocalTask.php \Drupal\social_event_invite\Plugin\Menu\LocalTask\EventInviteLocalTask::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

modules/social_features/social_event/modules/social_event_invite/src/Plugin/Menu/LocalTask/EventInviteLocalTask.php, line 59

Class

EventInviteLocalTask
Provides a local task that shows the amount of group invites.

Namespace

Drupal\social_event_invite\Plugin\Menu\LocalTask

Code

public function getTitle(Request $request = NULL) {

  /** @var \Drupal\social_event\EventEnrollmentStatusHelper $enrollments */
  $enrollments = \Drupal::service('social_event.status_helper');
  if ($enrollments
    ->getAllUserEventEnrollments(NULL)) {

    // We don't need plural because users will be redirected
    // if there is no invite.
    return $this
      ->t('Event invites (@count)', [
      '@count' => count($enrollments
        ->getAllUserEventEnrollments(NULL)),
    ]);
  }
  return $this
    ->t('Event invites');
}