Commit fed0e7e0 authored by catch's avatar catch

Issue #1879200 by pcambra, swentel, Berdir: Remove uneeded argument from entity type callbacks.

parent f296eace
......@@ -955,7 +955,7 @@ public function label($langcode = NULL) {
$langcode = $this->activeLangcode;
}
if (isset($entity_info['label_callback']) && function_exists($entity_info['label_callback'])) {
$label = $entity_info['label_callback']($this->entityType, $this, $langcode);
$label = $entity_info['label_callback']($this, $langcode);
}
elseif (!empty($entity_info['entity_keys']['label']) && isset($this->{$entity_info['entity_keys']['label']})) {
$label = $this->{$entity_info['entity_keys']['label']}->value;
......
......@@ -110,7 +110,7 @@ public function label($langcode = NULL) {
$label = NULL;
$entity_info = $this->entityInfo();
if (isset($entity_info['label_callback']) && function_exists($entity_info['label_callback'])) {
$label = $entity_info['label_callback']($this->entityType, $this, $langcode);
$label = $entity_info['label_callback']($this, $langcode);
}
elseif (!empty($entity_info['entity_keys']['label']) && isset($this->{$entity_info['entity_keys']['label']})) {
$label = $this->{$entity_info['entity_keys']['label']};
......
......@@ -377,8 +377,6 @@ function entity_test_entity_test_insert($entity) {
/**
* Entity label callback.
*
* @param $entity_type
* The entity type.
* @param $entity
* The entity object.
* @param $langcocde
......@@ -387,7 +385,7 @@ function entity_test_entity_test_insert($entity) {
* @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, $langcode = NULL) {
return 'label callback ' . $entity->name->value;
}
......
......@@ -34,7 +34,7 @@
* admin_permission = "administer user",
* base_table = "users",
* uri_callback = "user_uri",
* label_callback = "user_label",
* label_callback = "user_format_name",
* fieldable = TRUE,
* translatable = TRUE,
* entity_keys = {
......
......@@ -156,26 +156,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
* The entity object.
*
* @return
* The name of the user.
*
* @see user_format_name()
*/
function user_label($entity_type, $entity) {
return $entity->getUsername();
}
/**
* Populates $entity->account for each prepared entity.
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment