public function SmsSettingsForm::buildForm in SMS Framework 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 ConfigFormBase::buildForm
File
- src/
Form/ SmsSettingsForm.php, line 69
Class
- SmsSettingsForm
- Provides a form for SMS settings.
Namespace
Drupal\sms\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$sms_settings = $this
->config('sms.settings');
$gateways = [];
/** @var \Drupal\sms\Entity\SmsGatewayInterface $gateway */
foreach (SmsGateway::loadMultiple() as $gateway) {
$gateways[$gateway
->id()] = $gateway
->label();
}
$form['fallback_gateway'] = [
'#type' => 'select',
'#title' => $this
->t('Fallback gateway'),
'#description' => $this
->t('Gateway to use if no other module sets a gateway for a message.'),
'#options' => $gateways,
'#default_value' => $sms_settings
->get('fallback_gateway'),
'#empty_option' => $this
->t('- No Fallback Gateway -'),
];
$form['pages']['#tree'] = TRUE;
$form['pages']['verify'] = [
'#type' => 'textfield',
'#title' => t('Phone verification path'),
'#default_value' => $sms_settings
->get('page.verify'),
'#description' => t('Path of the phone number verification form.'),
'#size' => 30,
'#required' => TRUE,
'#field_prefix' => $this->requestContext
->getCompleteBaseUrl(),
];
return $form;
}