You are here

public function SecuresiteLoginForm::buildForm in Secure Site 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 FormInterface::buildForm

File

src/Form/SecuresiteLoginForm.php, line 30
Contains \Drupal\securesite\Form\SecuresiteLoginForm.

Class

SecuresiteLoginForm
Provides a user login form for securesite.

Namespace

Drupal\securesite\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['#theme'] = 'securesite_login_form';
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('User name'),
    '#maxlength' => USERNAME_MAX_LENGTH,
    '#size' => 15,
  );
  $form['pass'] = array(
    '#type' => 'password',
    '#title' => t('Password'),
    '#maxlength' => 60,
    '#size' => 15,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Log in'),
    '#weight' => 2,
  );
  if (\Drupal::moduleHandler()
    ->moduleExists('openid')) {
    global $base_path;
    $style = '<style type="text/css" media="all">' . "\n" . '#securesite-user-login li.openid-link {' . "\n" . '  background:transparent url(' . $base_path . drupal_get_path('module', 'openid') . '/login-bg.png) no-repeat scroll 1px 0.35em;' . "\n" . '}' . "\n" . '</style>';
    drupal_add_html_head($style);
  }
  return $form;
}