public function LdapUserTestForm::buildForm in Lightweight Directory Access Protocol (LDAP) 8.3
Same name and namespace in other branches
- 8.4 ldap_user/src/Form/LdapUserTestForm.php \Drupal\ldap_user\Form\LdapUserTestForm::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 FormInterface::buildForm
File
- ldap_user/
src/ Form/ LdapUserTestForm.php, line 68
Class
- LdapUserTestForm
- A form to allow the administrator to query LDAP.
Namespace
Drupal\ldap_user\FormCode
public function buildForm(array $form, FormStateInterface $form_state, $op = NULL) {
$form['#prefix'] = $this
->t('<h1>Debug LDAP synchronization events</h1>');
$form['usage'] = [
'#markup' => $this
->t("This form is for debugging issues with specific provisioning events. If you want to test your setup in general, try the server's test page first."),
];
$form['warning'] = [
'#markup' => '<h3>' . $this
->t('If you trigger the event this will modify your data.') . '</h3>' . $this
->t('When in doubt, always work on a staging environment.'),
];
$form['testing_drupal_username'] = [
'#type' => 'textfield',
'#title' => $this
->t('Testing Drupal Username'),
'#default_value' => $this->request->query
->get('username'),
'#required' => 1,
'#size' => 30,
'#maxlength' => 255,
'#description' => $this
->t("The user need not exist in Drupal and testing will not affect the user's LDAP or Drupal Account."),
];
$form['action'] = [
'#type' => 'radios',
'#title' => $this
->t('Actions/Event Handler to Test'),
'#required' => 0,
'#default_value' => $this->request->query
->get('action'),
'#options' => self::$syncTriggerOptions,
'#required' => TRUE,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Test'),
'#weight' => 100,
];
return $form;
}