You are here

public function MailingListSubscribeBlock::label in Mailgun 8

Overrides BlockPluginTrait::label

File

modules/mailgun_mailing_lists/src/Plugin/Block/MailingListSubscribeBlock.php, line 82

Class

MailingListSubscribeBlock
Provides a 'MailingListSubscribeBlock' block.

Namespace

Drupal\mailgun_mailing_lists\Plugin\Block

Code

public function label() {
  $config = $this
    ->getConfiguration();
  if (!empty($config['mailing_list'])) {
    $name = $this->mailgunClient
      ->mailingList()
      ->show($config['mailing_list'])
      ->getList()
      ->getName();
    return $this
      ->t('Subscribe to @name', [
      '@name' => $name,
    ]);
  }
  return parent::label();
}