You are here

protected function SubscriptionWidget::getOptions in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldWidget/SubscriptionWidget.php \Drupal\simplenews\Plugin\Field\FieldWidget\SubscriptionWidget::getOptions()
  2. 3.x src/Plugin/Field/FieldWidget/SubscriptionWidget.php \Drupal\simplenews\Plugin\Field\FieldWidget\SubscriptionWidget::getOptions()

Returns the array of options for the widget.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity for which to return options.

Return value

array The array of options for the widget.

Overrides OptionsWidgetBase::getOptions

1 call to SubscriptionWidget::getOptions()
SubscriptionWidget::getSelectedOptions in src/Plugin/Field/FieldWidget/SubscriptionWidget.php
Determines selected options from the incoming field values.

File

src/Plugin/Field/FieldWidget/SubscriptionWidget.php, line 62

Class

SubscriptionWidget
Plugin implementation of the 'simplenews_subscription_select' widget.

Namespace

Drupal\simplenews\Plugin\Field\FieldWidget

Code

protected function getOptions(FieldableEntityInterface $entity) {
  $options = parent::getOptions($entity);
  if (isset($this->newsletterIds)) {
    $options = array_intersect_key($options, array_flip($this->newsletterIds));
  }
  return $options;
}