-
Notifications
You must be signed in to change notification settings - Fork 0
/
account_field_split.module
65 lines (58 loc) · 2.33 KB
/
account_field_split.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?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;
/**
* 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::service('account_field_split.user_profile.extra_field_manager')
->formAlter($form, $form_state, $form_id);
}
/**
* Implements hook_entity_extra_field_info().
*/
function account_field_split_entity_extra_field_info() {
return \Drupal::service('account_field_split.user_profile.extra_field_manager')
->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']);
}
}