email_registration.install in Email Registration 8
Same filename and directory in other branches
Update and installation requirement hooks for the Email Registration module.
File
email_registration.installView source
<?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();
}
Functions
Name | Description |
---|---|
email_registration_requirements | Implements hook_requirements(). |
email_registration_update_8100 | Add an option to log in with the username as well as the email address. |