diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index 9eba621..e94516b 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -110,9 +110,15 @@ class EntityType implements EntityTypeInterface { /** * The name of a callback that returns the label of the entity. * - * @var string|null + * @var callable|null * * @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0. + * Use Drupal\Core\Entity\EntityInterface::label() for complex label + * generation as needed. + * + * @see \Drupal\Core\Entity\EntityInterface::label() + * + * @todo Remove usages of label_callback https://www.drupal.org/node/2450793. */ protected $label_callback = NULL; diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index 4ecf75a..c8a2e65 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -108,7 +108,8 @@ public function getOriginalClass(); * - label: (optional) The name of the property that contains the entity * label. For example, if the entity's label is located in * $entity->subject, then 'subject' should be specified here. If complex - * logic is required to build the label, Entity::label() should be used. + * logic is required to build the label, + * \Drupal\Core\Entity\EntityInterface::label() should be used. * - langcode: (optional) The name of the property that contains the * language code. For instance, if the entity's language is located in * $entity->langcode, then 'langcode' should be specified here. @@ -492,17 +493,21 @@ public function setLinkTemplate($key, $path); * 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. + * 'entity_keys' return value component to provide this information. 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. * * @return callable|null * The callback, or NULL if none exists. * * @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0. + * Use Drupal\Core\Entity\EntityInterface::label() for complex label + * generation as needed. + * + * @see \Drupal\Core\Entity\EntityInterface::label() + * @see \Drupal\Core\Entity\EntityTypeInterface::setLabelCallback() + * @see \Drupal\Core\Entity\EntityTypeInterface::hasLabelCallback() * * @todo Remove usages of label_callback https://www.drupal.org/node/2450793. */ @@ -517,6 +522,11 @@ public function getLabelCallback(); * @return $this * * @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0. + * Use EntityInterface::label() for complex label generation as needed. + * + * @see \Drupal\Core\Entity\EntityInterface::label() + * @see \Drupal\Core\Entity\EntityTypeInterface::getLabelCallback() + * @see \Drupal\Core\Entity\EntityTypeInterface::hasLabelCallback() */ public function setLabelCallback($callback); @@ -526,6 +536,11 @@ public function setLabelCallback($callback); * @return bool * * @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0. + * Use EntityInterface::label() for complex label generation as needed. + * + * @see \Drupal\Core\Entity\EntityInterface::label() + * @see \Drupal\Core\Entity\EntityTypeInterface::getLabelCallback() + * @see \Drupal\Core\Entity\EntityTypeInterface::setLabelCallback() */ public function hasLabelCallback(); diff --git a/core/modules/user/src/Entity/User.php b/core/modules/user/src/Entity/User.php index 3716d01..f452ec6 100644 --- a/core/modules/user/src/Entity/User.php +++ b/core/modules/user/src/Entity/User.php @@ -44,7 +44,6 @@ * admin_permission = "administer users", * base_table = "users", * data_table = "users_field_data", - * label_callback = "user_format_name", * translatable = TRUE, * entity_keys = { * "id" = "uid",