You are here

function simplelogin_form_alter in SimpleLogin 8.6

Same name and namespace in other branches
  1. 7 simplelogin.module \simplelogin_form_alter()

Implements hook_form_alter().

File

./simplelogin.module, line 200
The module file for simplelogin pages module.

Code

function simplelogin_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $types = array(
    'textfield',
    'email',
    'textarea',
    'password',
    'container',
  );
  foreach ($form as $key => $value) {
    switch ($form_id) {
      case 'user_register_form':
        foreach ($form['account'] as $key => $val) {
          if (isset($form['account'][$key]['#type'])) {
            if (in_array($form['account'][$key]['#type'], $types)) {
              $form['account'][$key]['#attributes']["placeholder"] = $form['account'][$key]["#title"];
              $form['account'][$key]['#title_display'] = 'invisible';
              $form['account'][$key]['#description'] = '';
            }
          }
        }
        break;
      case 'user_login_form':
        $form['actions']['submit']['#value'] = t('Login to Account');
      case 'user_pass':
        if (isset($value['#type']) && in_array($value['#type'], $types)) {
          $form[$key]['#attributes']["placeholder"] = $value["#title"];
          $form[$key]['#title_display'] = 'invisible';
          $form[$key]['#description'] = '';
        }
        break;
    }
  }

  //if (\Drupal::moduleHandler()->moduleExists('captcha')) {

  //$form['captcha']['#after_build'][] = 'simplelogin_set_captcha';

  //}
}