You are here

protected function SubscriptionsFormBase::extractNewsletterIds in Simplenews 3.x

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

Extracts selected/deselected newsletters IDs from the subscriptions widget.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: Form state object.

bool $selected: Whether to extract selected (TRUE) or deselected (FALSE) newsletter IDs.

Return value

string[] IDs of selected/deselected newsletters.

2 calls to SubscriptionsFormBase::extractNewsletterIds()
SubscriptionsBlockForm::submitExtra in src/Form/SubscriptionsBlockForm.php
Submit callback that subscribes to selected newsletters.
SubscriptionsFormBase::submitExtra in src/Form/SubscriptionsFormBase.php
Submit callback that (un)subscribes to newsletters based on selection.

File

src/Form/SubscriptionsFormBase.php, line 181

Class

SubscriptionsFormBase
Entity form for Subscriber with common routines.

Namespace

Drupal\simplenews\Form

Code

protected function extractNewsletterIds(FormStateInterface $form_state, $selected) {
  return $this
    ->getSubscriptionWidget($form_state)
    ->extractNewsletterIds($form_state
    ->getValue('subscriptions'), $selected);
}