protected function SubscriptionsFormBase::getOnlyNewsletterId in Simplenews 8.2
Same name and namespace in other branches
- 8 src/Form/SubscriptionsFormBase.php \Drupal\simplenews\Form\SubscriptionsFormBase::getOnlyNewsletterId()
- 3.x src/Form/SubscriptionsFormBase.php \Drupal\simplenews\Form\SubscriptionsFormBase::getOnlyNewsletterId()
Convenience method for the case of only one available newsletter.
Return value
string|null If there is exactly one newsletter available in this form, this method returns its ID. Otherwise it returns NULL.
See also
::setNewsletterIds()
1 call to SubscriptionsFormBase::getOnlyNewsletterId()
- SubscriptionsFormBase::actions in src/
Form/ SubscriptionsFormBase.php - Returns an array of supported actions for the current entity form.
File
- src/
Form/ SubscriptionsFormBase.php, line 95
Class
- SubscriptionsFormBase
- Entity form for Subscriber with common routines.
Namespace
Drupal\simplenews\FormCode
protected function getOnlyNewsletterId() {
$newsletters = $this
->getNewsletterIds();
if (count($newsletters) == 1) {
return array_shift($newsletters);
}
return NULL;
}