diff --git a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php index 3dbbb39..d7e51c6 100644 --- a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php +++ b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php @@ -117,15 +117,15 @@ class EntityType extends Plugin { /** * The name of a function that returns the label of the entity. * - * The function takes an entity and optional langcode argument, and returns - * the label of the entity. If langcode is omitted, the entity's default - * language is used. The entity label is the main string associated with an - * entity; for example, the title of a node or the subject of a comment. If - * there is an entity object property that defines the label, use the 'label' - * element of the 'entity_keys' return value component to provide this - * information (see below). If more complex logic is needed to determine the - * label of an entity, you can instead specify a callback function here, which - * will be called to determine the entity label. See also the + * The function takes an entity and returns the label of the entity. Use + * language() on the entity to get information on the requested language. + * The entity label is the main string associated with an entity; for + * example, the title of a node or the subject of a comment. If there is an + * entity object property that defines the label, use the 'label' element of + * the 'entity_keys' return value component to provide this information (see + * below). If more complex logic is needed to determine the label of an + * entity, you can instead specify a callback function here, which will be + * called to determine the entity label. See also the * \Drupal\Core\Entity\EntityInterface::label() method, which implements this * logic. * diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index 2348856..242e142 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -381,13 +381,11 @@ function entity_test_entity_test_insert($entity) { * The entity type. * @param $entity * The entity object. - * @param $langcocde - * (optional) The langcode. * * @return * The label of the entity prefixed with "label callback". */ -function entity_test_label_callback($entity_type, $entity, $langcode = NULL) { +function entity_test_label_callback($entity_type, $entity) { return 'label callback ' . $entity->name->value; } diff --git a/core/modules/user/lib/Drupal/user/Entity/User.php b/core/modules/user/lib/Drupal/user/Entity/User.php index c667d20..c3273ab 100644 --- a/core/modules/user/lib/Drupal/user/Entity/User.php +++ b/core/modules/user/lib/Drupal/user/Entity/User.php @@ -455,6 +455,8 @@ public static function baseFieldDefinitions($entity_type) { 'description' => t("The user's preferred langcode for viewing administration pages."), 'type' => 'language_field', ); + // The name should not vary per language. The username is the visual + // identifier for a user and needs to be consistent in all languages. $properties['name'] = array( 'label' => t('Name'), 'description' => t('The name of this user'), diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 4ee0675..055c90e 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -158,9 +158,6 @@ function user_uri($user) { /** * Entity label callback. * - * This label callback has langcode for security reasons. The username is the - * visual identifier for a user and needs to be consistent in all languages. - * * @param $entity_type * The entity type. * @param $entity