public function super_loginSettingsForm::buildForm in Super Login 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/
Super_loginSettingsForm.php, line 33
Class
- super_loginSettingsForm
- Configure Super Login settings for this site.
Namespace
Drupal\super_loginCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('super_login.settings');
$form['text'] = [
'#type' => 'fieldset',
'#title' => t('Text String Options'),
];
$form['text']['login_title'] = [
'#type' => 'textfield',
'#title' => $this
->t('Log In Text'),
'#description' => $this
->t('Enter the text to be displayed above the login form.'),
'#default_value' => $config
->get('super_login.login_title'),
];
$form['text']['forgot_pw_text'] = [
'#type' => 'textfield',
'#title' => $this
->t('Forgot Password Link Text'),
'#description' => $this
->t("Enter the text to be displayed as the forgot password's link anchor text."),
'#default_value' => $config
->get('super_login.forgot_pw_text'),
];
$form['text']['capslock_msg'] = [
'#type' => 'textfield',
'#title' => $this
->t('Caps Lock Message'),
'#description' => $this
->t('Enter the text to be displayed when a user tries to enter a password with the caps look on.'),
'#default_value' => $config
->get('super_login.capslock_msg'),
];
$form['text']['new_account_text'] = [
'#type' => 'textfield',
'#title' => $this
->t('New Account Text'),
'#description' => $this
->t('Enter the text to be displayed for the new account link.'),
'#default_value' => $config
->get('super_login.new_account_text'),
];
$form['text']['login_text'] = [
'#type' => 'textfield',
'#title' => $this
->t('Login Title'),
'#description' => $this
->t('Enter the text to be displayed above the username/email login field.'),
'#default_value' => $config
->get('super_login.login_text'),
];
$form['text']['password_reset_title'] = [
'#type' => 'textfield',
'#title' => $this
->t('Password Reset Title'),
'#description' => $this
->t('Enter the title to be displayed on the password reset page.'),
'#default_value' => $config
->get('super_login.password_reset_title'),
];
$form['text']['back_link'] = [
'#type' => 'textfield',
'#title' => $this
->t('Back to Login Page Text.'),
'#description' => $this
->t('Enter the text to be displayed for the "back to login page" link.'),
'#default_value' => $config
->get('super_login.back_link'),
];
$form['options'] = [
'#type' => 'fieldset',
'#title' => t('Configuration Options'),
];
$options = [
0 => t('Username or Email Address'),
1 => t('Username Only'),
2 => t('Email Address Only'),
];
$form['options']['login_type'] = [
'#type' => 'radios',
'#options' => $options,
'#title' => $this
->t('Login Type'),
'#description' => $this
->t('Options to allow logging into the site with.'),
'#default_value' => $config
->get('super_login.login_type'),
];
$form['options']['messages'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Show system messages outside of login form'),
'#description' => $this
->t('Disable this option to display system messages in the default/normal Drupal location'),
'#default_value' => $config
->get('super_login.messages'),
];
$form['options']['css'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable module CSS (stylesheet)'),
'#description' => $this
->t("Disable this option to turn off this module's CSS style sheet. If disabled, you should provide your own styling through your theme's stylesheet."),
'#default_value' => $config
->get('super_login.css'),
];
$form['options']['capslock'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable Caps Lock Warning'),
'#description' => $this
->t('Disable this option to turn off the caps lock warning message for the password field.'),
'#default_value' => $config
->get('super_login.capslock'),
];
$form['options']['button_theme'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable replacement of standard submit button with CSS3 theme.'),
'#disabled' => $config
->get('super_login.css') ? FALSE : TRUE,
'#description' => t('Disable this option to remove the CSS3 theme on the submit buttons.'),
'#default_value' => $config
->get('super_login.button_theme'),
];
$form['options']['autofocus'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable autofocus for username field'),
'#default_value' => $config
->get('super_login.autofocus'),
'#description' => t('Enable this option for browsers to automatically set the focus in username field.'),
];
$form['options']['placeholder'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable "placeholder" text within fields.'),
'#description' => $this
->t('Disable this option to remove the placeholder text within the login and password reset fields.'),
'#default_value' => $config
->get('super_login.placeholder'),
];
$form['options']['placeholders'] = [
'#type' => 'container',
'#states' => [
'visible' => [
':input[name="placeholder"]' => [
'checked' => TRUE,
],
],
],
];
$form['options']['placeholders']['login_placeholder'] = [
'#type' => 'textfield',
'#title' => $this
->t('Login Placeholder'),
'#description' => $this
->t('Enter the text to be displayed as placeholder for the username/email login field.'),
'#default_value' => $config
->get('super_login.login_placeholder'),
];
$form['options']['placeholders']['pass_placeholder'] = [
'#type' => 'textfield',
'#title' => $this
->t('Password Placeholder'),
'#description' => $this
->t('Enter the text to be displayed as placeholder for the password field.'),
'#default_value' => $config
->get('super_login.pass_placeholder'),
];
return parent::buildForm($form, $form_state);
}