passwd_only-8.x-1.x-dev/passwd_only.install

passwd_only.install
<?php

use Drupal\Core\Url;
/**
 * @file
 * Creates an user, who has the ability to login by password only.
 */

/**
 * @addtogroup drupal_hooks
 * @{
 */

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

  if ($phase == 'runtime') {
    $config = \Drupal::config('passwd_only.all');
    $uid = $config->get('user');
    if (!$uid) {
      $requirements['passwd_only'] = [
        'title' => t('Password Only Login'),
        'value' => t('You have to select one user account.'),
        'description' => t(
          '<a href="@select">Select an user account</a>.',
          [
            '@select' => Url::fromRoute('password_only.configuration')->toString(),
          ]
        ),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }

  return $requirements;
}

/**
 * @} End of "addtogroup drupal_hooks".
 */

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

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