diff --git a/src/Plugin/Field/FieldFormatter/SimplenewsSubscriptionStatusFormatter.php b/src/Plugin/Field/FieldFormatter/SimplenewsSubscriptionStatusFormatter.php index 3cea4d6..93edadb 100644 --- a/src/Plugin/Field/FieldFormatter/SimplenewsSubscriptionStatusFormatter.php +++ b/src/Plugin/Field/FieldFormatter/SimplenewsSubscriptionStatusFormatter.php @@ -31,25 +31,23 @@ class SimplenewsSubscriptionStatusFormatter extends EntityReferenceLabelFormatte // Call the parent to create the subscriptions labels. $elements = parent::viewElements($items); foreach ($this->getEntitiesToView($items) as $delta => $entity) { - $output = ''; + $label = $entity->label(); + + // Add label for subscribed. + $output = $this->t('@label', array('@label' => $label)); // Add status label for the unconfirmed subscriptions. if ($items[$delta]->status == SIMPLENEWS_SUBSCRIPTION_STATUS_UNCONFIRMED) { - $output = 'Unconfirmed'; + $output = $this->t('@label (Unconfirmed)', array('@label' => $label)); } // Add status label for the unsubscribed subscriptions. if ($items[$delta]->status == SIMPLENEWS_SUBSCRIPTION_STATUS_UNSUBSCRIBED) { - $output = 'Unsubscribed'; + $output = $this->t('@label (Unsubscribed)', array('@label' => $label)); } // Add the label. - if ($output) { - $elements[$delta]['#title'] = $this->t('@label (@status)', array( - '@label' => $entity->label(), - '@status' => $output, - )); - } + $elements[$delta]['#title'] = $output; } return $elements;