You are here

protected function SubscriptionsFormBase::extractNewsletterIds in Simplenews 8.2

Same name and namespace in other branches
  1. 8 src/Form/SubscriptionsFormBase.php \Drupal\simplenews\Form\SubscriptionsFormBase::extractNewsletterIds()
  2. 3.x 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.

3 calls to SubscriptionsFormBase::extractNewsletterIds()
SubscriptionsFormBase::submitSubscribe in src/Form/SubscriptionsFormBase.php
Submit callback that subscribes to selected newsletters.
SubscriptionsFormBase::submitUnsubscribe in src/Form/SubscriptionsFormBase.php
Submit callback that unsubscribes from selected newsletters.
SubscriptionsFormBase::submitUpdate in src/Form/SubscriptionsFormBase.php
Submit callback that (un)subscribes to newsletters based on selection.

File

src/Form/SubscriptionsFormBase.php, line 334

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);
}