account_field_split.module in Account field split 8
Same filename and directory in other branches
account_field_split module hooks and alters.
File
account_field_split.moduleView source
<?php
/**
* @file
* account_field_split module hooks and alters.
*/
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
use Drupal\Core\Link;
use Drupal\account_field_split\ExtraFieldManager;
/**
* Implements hook_help().
*/
function account_field_split_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the account_field_split module.
case 'help.page.account_field_split':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Currently the dragable field "User name and password" mashes together:') . '</p>';
$output .= '<ul>';
$output .= '<li>' . 'Username' . '</li>';
$output .= '<li>' . 'Current password' . '</li>';
$output .= '<li>' . 'E-mail address' . '</li>';
$output .= '<li>' . 'Change Password' . '</li>';
$output .= '<li>' . 'Roles' . '</li>';
$output .= '<li>' . 'Status' . '</li>';
$output .= '<li>' . 'Notify user about new account (when admin create new account)' . '</li>';
$output .= '</ul>';
$output .= '<p>' . t('This module aims to fix that problem for site builders who want to manage that fields separately.') . '</p>';
$output .= '<h3>' . t('Usage') . '</h3>';
$output .= '<p>' . t('After enabling of this module you will see a list of new fields on %link.', [
'%link' => Link::fromTextAndUrl('Account settings Manage form display', Url::fromUserInput('/admin/config/people/accounts/form-display'))
->toString(),
]) . '</p>';
$output .= '<p>' . t('Manage or reorder them for your needs.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_form_alter().
*/
function account_field_split_form_alter(&$form, FormStateInterface $form_state, $form_id) {
\Drupal::classResolver()
->getInstanceFromDefinition(ExtraFieldManager::class)
->formAlter($form, $form_state, $form_id);
}
/**
* Implements hook_entity_extra_field_info().
*/
function account_field_split_entity_extra_field_info() {
return \Drupal::classResolver()
->getInstanceFromDefinition(ExtraFieldManager::class)
->extraFieldInfo();
}
/**
* Implements hook_entity_extra_field_info_alter().
*/
function account_field_split_entity_extra_field_info_alter(&$info) {
if (isset($info['user']['user']['form']['account'])) {
unset($info['user']['user']['form']['account']);
}
}
Functions
Name | Description |
---|---|
account_field_split_entity_extra_field_info | Implements hook_entity_extra_field_info(). |
account_field_split_entity_extra_field_info_alter | Implements hook_entity_extra_field_info_alter(). |
account_field_split_form_alter | Implements hook_form_alter(). |
account_field_split_help | Implements hook_help(). |