public function CampaignMonitorNodeSettingsForm::buildForm in Campaign Monitor 8
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
- modules/
campaignmonitor_campaign/ src/ Form/ CampaignMonitorNodeSettingsForm.php, line 58
Class
- CampaignMonitorNodeSettingsForm
- Node Access settings form.
Namespace
Drupal\campaignmonitor_campaign\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $node_type = NULL) {
$storage = [
'node_type' => $node_type,
];
$form_state
->setStorage($storage);
$form['lists'] = [
'#type' => 'checkboxes',
'#options' => campaignmonitor_get_list_options(),
'#title' => t('Lists'),
'#description' => t('The lists that this node type is published to'),
'#default_value' => campaignmonitor_campaign_get_node_settings('lists', $node_type),
];
$form['view_mode'] = [
'#type' => 'select',
'#options' => $this->entityManager
->getViewModeOptionsByBundle('node', $node_type),
'#description' => t('The view mode to use for the content of the campaign'),
'#title' => $this
->t('View mode'),
'#default_value' => campaignmonitor_campaign_get_node_settings('view_mode', $node_type),
];
$form['submit'] = [
'#type' => 'submit',
'#value' => t('Submit'),
'#weight' => 10,
];
return $form;
}