Same filename and directory in other branches
  1. 8.9.x core/modules/jsonapi/tests/modules/jsonapi_test_user/jsonapi_test_user.module
  2. 9 core/modules/jsonapi/tests/modules/jsonapi_test_user/jsonapi_test_user.module

Support module for JSON:API user hooks testing.

File

core/modules/jsonapi/tests/modules/jsonapi_test_user/jsonapi_test_user.module
View source
<?php

/**
 * @file
 * Support module for JSON:API user hooks testing.
 */
use Drupal\Core\Session\AccountInterface;

/**
 * Implements hook_user_format_name_alter().
 */
function jsonapi_test_user_user_format_name_alter(&$name, AccountInterface $account) {
  if ($account
    ->isAnonymous()) {
    $name = 'User ' . $account
      ->id();
  }
}

Functions