public function SettingsForm::buildForm in Sparkpost email 8
Same name and namespace in other branches
- 8.2 src/Form/SettingsForm.php \Drupal\sparkpost\Form\SettingsForm::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 ConfigFormBase::buildForm
File
- src/
Form/ SettingsForm.php, line 34
Class
- SettingsForm
- Class SettingsForm.
Namespace
Drupal\sparkpost\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('sparkpost.settings');
$form['api_key'] = [
'#type' => 'textfield',
'#title' => $this
->t('API Key'),
'#default_value' => $config
->get('api_key'),
];
$form['sender'] = [
'#type' => 'email',
'#title' => $this
->t('Sender'),
'#default_value' => $config
->get('sender'),
];
$form['sender_name'] = [
'#type' => 'textfield',
'#title' => $this
->t('Sender Name'),
'#default_value' => $config
->get('sender_name'),
];
return parent::buildForm($form, $form_state);
}