You are here

public function SubscriptionsFormBase::getNewsletters in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Form/SubscriptionsFormBase.php \Drupal\simplenews\Form\SubscriptionsFormBase::getNewsletters()
  2. 3.x src/Form/SubscriptionsFormBase.php \Drupal\simplenews\Form\SubscriptionsFormBase::getNewsletters()

Returns the newsletters available to select from.

Return value

\Drupal\simplenews\Entity\Newsletter[] The newsletters available to select from, indexed by ID.

3 calls to SubscriptionsFormBase::getNewsletters()
SubscriptionsBlockForm::form in src/Form/SubscriptionsBlockForm.php
Gets the actual form array to be built.
SubscriptionsFormBase::form in src/Form/SubscriptionsFormBase.php
Gets the actual form array to be built.
SubscriptionsFormBase::getNewsletterIds in src/Form/SubscriptionsFormBase.php
Returns the newsletters available to select from.

File

src/Form/SubscriptionsFormBase.php, line 68

Class

SubscriptionsFormBase
Entity form for Subscriber with common routines.

Namespace

Drupal\simplenews\Form

Code

public function getNewsletters() {
  if (!isset($this->newsletters)) {
    $this
      ->setNewsletterIds(array_keys(simplenews_newsletter_get_visible()));
  }
  return $this->newsletters;
}