You are here

protected function CampaignMonitorSubscribeForm::userSelectSubscribeForm in Campaign Monitor 8

Same name and namespace in other branches
  1. 8.2 src/Form/CampaignMonitorSubscribeForm.php \Drupal\campaignmonitor\Form\CampaignMonitorSubscribeForm::userSelectSubscribeForm()
1 call to CampaignMonitorSubscribeForm::userSelectSubscribeForm()
CampaignMonitorSubscribeForm::buildForm in src/Form/CampaignMonitorSubscribeForm.php
Form constructor.

File

src/Form/CampaignMonitorSubscribeForm.php, line 264

Class

CampaignMonitorSubscribeForm
Subscribe to a campaignmonitor list.

Namespace

Drupal\campaignmonitor\Form

Code

protected function userSelectSubscribeForm(array $form, FormStateInterface $form_state, $config = []) {
  $form = [];

  // Set options for the form.
  $form = [
    '#tree' => TRUE,
    '#attributes' => [
      'class' => [
        'campaignmonitor-subscribe-form',
        'campaignmonitor-subscribe-form-all-lists',
      ],
    ],
  ];
  $lists = campaignmonitor_get_lists();
  $options = [];
  foreach ($lists as $list_id => $list) {
    $options[$list_id] = $list['name'];
  }
  $form['selection'] = [
    '#type' => 'checkboxes',
    '#options' => $options,
    '#title' => t('Lists'),
  ];
  return $form;
}