You are here

protected function Subscriptions::getLabel in Message Subscribe 8

Get a subscription checkbox label for a given entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The referenced entity.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The label for the subscription checkbox.

1 call to Subscriptions::getLabel()
Subscriptions::buildForm in message_subscribe_ui/src/Plugin/Block/Subscriptions.php
Form constructor.

File

message_subscribe_ui/src/Plugin/Block/Subscriptions.php, line 203

Class

Subscriptions
An entity subscriptions block.

Namespace

Drupal\message_subscribe_ui\Plugin\Block

Code

protected function getLabel(EntityInterface $entity) {
  $label = $entity instanceof UserInterface ? $entity
    ->getDisplayName() : $entity
    ->label();
  return $this
    ->t('Subscribe to @label', [
    '@label' => $label,
  ]);
}