Skip to content
Snippets Groups Projects

Rector

Open nicxvan requested to merge issue/drupal-3481582:3481582-rectorrule1.3 into 11.x
5 unresolved threads

Closes #3481582

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
22 use Drupal\system\Entity\Action;
23 use Drupal\user\Entity\Role;
24 use Drupal\user\Entity\User;
25 use Drupal\user\RoleInterface;
26 use Drupal\user\UserInterface;
27
28 /**
29 * Hook implementations.
30 */
31 class UserHooks {
32
33 /**
34 * Implements hook_help().
35 */
36 #[Hook('help')]
37 public function userHelp($route_name, RouteMatchInterface $route_match) {
  • 97 // can be reliably cached on the client side.
    98 $user = \Drupal::currentUser();
    99 $settings['user']['uid'] = $user->id();
    100 $settings['user']['permissionsHash'] = \Drupal::service('user_permissions_hash_generator')->generate($user);
    101 }
    102
    103 /**
    104 * Returns whether this site supports the default user picture feature.
    105 *
    106 * This approach preserves compatibility with node/comment templates. Alternate
    107 * user picture implementations (e.g., Gravatar) should provide their own
    108 * add/edit/delete forms and populate the 'picture' variable during the
    109 * preprocess stage.
    110 */
    111 #[Hook('picture_enabled')]
    112 public function userPictureEnabled() {
  • 107 * user picture implementations (e.g., Gravatar) should provide their own
    108 * add/edit/delete forms and populate the 'picture' variable during the
    109 * preprocess stage.
    110 */
    111 #[Hook('picture_enabled')]
    112 public function userPictureEnabled() {
    113 $field_definitions = \Drupal::service('entity_field.manager')->getFieldDefinitions('user', 'user');
    114 return isset($field_definitions['user_picture']);
    115 }
    116
    117 /**
    118 * Implements hook_entity_extra_field_info().
    119 */
    120 #[Hook('entity_extra_field_info')]
    121 public function userEntityExtraFieldInfo() {
    122 $fields['user']['user']['form']['account'] = ['label' => \t('User name and password'), 'description' => \t('User module account form elements.'), 'weight' => -10];
  • 143 }
    144
    145 /**
    146 * Fetches a user object by email address.
    147 *
    148 * @param string $mail
    149 * String with the account's email address.
    150 *
    151 * @return \Drupal\user\UserInterface|false
    152 * A fully-loaded $user object upon successful user load or FALSE if user
    153 * cannot be loaded.
    154 *
    155 * @see \Drupal\user\Entity\User::loadMultiple()
    156 */
    157 #[Hook('load_by_mail')]
    158 public function userLoadByMail($mail) {
  • 213 *
    214 * @deprecated in drupal:11.0.0 and is removed from drupal:12.0.0. Use
    215 * Drupal\user\UserInterface::isBlocked() instead.
    216 * @see https://www.drupal.org/node/3411040
    217 */
    218 #[Hook('is_blocked')]
    219 public function userIsBlocked($name) {
    220 @\trigger_error('user_is_blocked() is deprecated in drupal:11.0.0 and is removed from drupal:12.0.0. Use \Drupal\user\UserInterface::isBlocked() instead. See https://www.drupal.org/node/3411040', \E_USER_DEPRECATED);
    221 return (bool) \Drupal::entityQuery('user')->accessCheck(\FALSE)->condition('name', $name)->condition('status', 0)->execute();
    222 }
    223
    224 /**
    225 * Implements hook_ENTITY_TYPE_view() for user entities.
    226 */
    227 #[Hook('user_view')]
    228 public function userUserView(array &$build, UserInterface $account, EntityViewDisplayInterface $display) {
  • nicxvan added 3 commits

    added 3 commits

    Compare with previous version

  • nicxvan added 1 commit

    added 1 commit

    • bd89a15e - Fix unused use statements and update baseline

    Compare with previous version

  • Please register or sign in to reply
    Loading