disable_autopopulate_rform-2.0.0/disable_autopopulate_rform.module

disable_autopopulate_rform.module
<?php

/**
 * @file
 * Contains disable_autopopulate_rform.module.
 */

use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_help().
 */
function disable_autopopulate_rform_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    // Main module help for the disable_autopopulate_rform module.
    case 'help.page.disable_autopopulate_rform':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('This module prevent previously registered user information to be auto-populated on the registration form.') . '</p>';
      return $output;

    default:
  }
}

/**
 * Implements hook_form_FORM_ID_alter() for \Drupal\user\RegisterForm.
 */
function disable_autopopulate_rform_form_user_register_form_alter(&$form, FormStateInterface $form_state) {
  $form['#attributes']['data-user-info-from-browser'] = FALSE;
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc