email_registration-8.x-1.1/email_registration.install

email_registration.install
<?php

/**
 * @file
 * Update and installation requirement hooks for the Email Registration module.
 */

/**
 * Implements hook_requirements().
 */
function email_registration_requirements() {
  $requirements = [];

  // @todo Get rid of variable_get() and check is this conflict still valid.
  if (\Drupal::moduleHandler()->moduleExists('logintoboggan') && \Drupal::config('logintoboggan.settings')->get('login_with_email')) {
    $requirements['email_registration'] = [
      'title' => t('Email Registration / LoginToboggan Conflict'),
      'value' => t('Conflict'),
      'description' => t('There is a conflict between %email_registration and %logintoboggan. You should disable the "Allow users to login using their email address" option from %logintoboggan.', [
        '%email_registration' => 'Email registration',
        '%logintoboggan' => 'Login Toboggan',
      ]),
      'severity' => REQUIREMENT_ERROR,
    ];
  }

  return $requirements;
}

/**
 * Add an option to log in with the username as well as the email address.
 */
function email_registration_update_8100() {
  $config_factory = \Drupal::configFactory();
  $email_registration = $config_factory->getEditable('email_registration.settings');
  $email_registration->set('login_with_username', FALSE);
  $email_registration->save();
}

/**
 * Remove the removed "require_username_on_registration" config.
 */
function email_registration_update_9001() {
  $config = \Drupal::configFactory()->getEditable('email_registration.settings');
  $config->clear('require_username_on_registration');
  $config->save();
}

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

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