public function SubscriberMassUnsubscribeForm::buildForm in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Form/SubscriberMassUnsubscribeForm.php \Drupal\simplenews\Form\SubscriberMassUnsubscribeForm::buildForm()
- 3.x src/Form/SubscriberMassUnsubscribeForm.php \Drupal\simplenews\Form\SubscriberMassUnsubscribeForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- src/
Form/ SubscriberMassUnsubscribeForm.php, line 24
Class
- SubscriberMassUnsubscribeForm
- Do a mass subscription for a list of email addresses.
Namespace
Drupal\simplenews\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['emails'] = array(
'#type' => 'textarea',
'#title' => t('Email addresses'),
'#cols' => 60,
'#rows' => 5,
'#description' => t('Email addresses must be separated by comma, space or newline.'),
);
$form['newsletters'] = array(
'#type' => 'checkboxes',
'#title' => t('Unsubscribe from'),
'#options' => simplenews_newsletter_list(),
'#required' => TRUE,
);
foreach (simplenews_newsletter_get_all() as $id => $newsletter) {
$form['newsletters'][$id]['#description'] = Html::escape($newsletter->description);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Unsubscribe'),
);
return $form;
}