You are here

public function RecipientHandlerSubscribersByRole::settingsForm in Simplenews 8.2

Same name and namespace in other branches
  1. 3.x modules/simplenews_demo/src/Plugin/simplenews/RecipientHandler/RecipientHandlerSubscribersByRole.php \Drupal\simplenews_demo\Plugin\simplenews\RecipientHandler\RecipientHandlerSubscribersByRole::settingsForm()

Returns the elements to add to the settings form for handler settings.

Return value

array The form elements.

Overrides RecipientHandlerBase::settingsForm

File

modules/simplenews_demo/src/Plugin/simplenews/RecipientHandler/RecipientHandlerSubscribersByRole.php, line 21

Class

RecipientHandlerSubscribersByRole
This handler sends to all subscribers with the specified role.

Namespace

Drupal\simplenews_demo\Plugin\simplenews\RecipientHandler

Code

public function settingsForm() {
  $roles = array_map([
    '\\Drupal\\Component\\Utility\\Html',
    'escape',
  ], user_role_names(TRUE));
  $element['role'] = [
    '#type' => 'select',
    '#title' => t('Role'),
    '#default_value' => $this->configuration['role'] ?? NULL,
    '#options' => $roles,
  ];
  return $element;
}