public function LiveChatLicenseForm::buildForm in LiveChat 8
Same name and namespace in other branches
- 8.2 src/Form/LiveChatLicenseForm.php \Drupal\livechat\Form\LiveChatLicenseForm::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/ LiveChatLicenseForm.php, line 64
Class
- LiveChatLicenseForm
- Configure Coffee for this site.
Namespace
Drupal\livechat\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config(LIVECHAT_CONFIGURATION_NAME);
$form['account'] = [
'#type' => 'details',
'#open' => TRUE,
'#title' => $this
->t('Account details'),
];
$form['account']['login'] = [
'#type' => 'email',
'#title' => $this
->t('LiveChat login'),
'#description' => $this
->t('User account login: my@email.com'),
'#default_value' => $config
->get('livechat_login'),
'#required' => TRUE,
];
if (!empty($config
->get('livechat_login')) && !empty($config
->get('livechat_license'))) {
$form['account']['license_number'] = [
'#type' => 'textfield',
'#title' => $this
->t('License number'),
'#default_value' => $config
->get('livechat_license'),
'#required' => TRUE,
'#attributes' => [
'disabled' => 'disabled',
],
];
}
return parent::buildForm($form, $form_state);
}