You are here

public function LdapAuthenticationProfileUpdateForm::buildForm in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_authentication/src/Form/LdapAuthenticationProfileUpdateForm.php \Drupal\ldap_authentication\Form\LdapAuthenticationProfileUpdateForm::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_authentication/src/Form/LdapAuthenticationProfileUpdateForm.php, line 70

Class

LdapAuthenticationProfileUpdateForm
Profile update form.

Namespace

Drupal\ldap_authentication\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) : array {
  if (EmailTemplateService::profileNeedsUpdate()) {
    $form['mail'] = [
      '#type' => 'textfield',
      '#required' => TRUE,
      '#title' => $this
        ->t('Email address'),
    ];
    $form['submit'] = [
      '#type' => 'submit',
      '#value' => $this
        ->t('Update account'),
    ];
  }
  else {
    $form['submit'] = [
      '#markup' => '<h2>' . $this
        ->t('This form is only available to profiles which need an update.') . '</h2>',
    ];
  }
  return $form;
}