Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
38311dc9
Commit
38311dc9
authored
May 04, 2011
by
Dries
Browse files
- Patch
#1096446
by plach: entity_label() is not passing along the () parameter.
parent
c7b11caa
Changes
3
Hide whitespace changes
Inline
Side-by-side
includes/common.inc
View file @
38311dc9
...
...
@@ -7584,7 +7584,7 @@ function entity_label($entity_type, $entity) {
$label
=
FALSE
;
$info
=
entity_get_info
(
$entity_type
);
if
(
isset
(
$info
[
'label callback'
])
&&
function_exists
(
$info
[
'label callback'
]))
{
$label
=
$info
[
'label callback'
](
$entity
);
$label
=
$info
[
'label callback'
](
$entity_type
,
$entity
);
}
elseif
(
!
empty
(
$info
[
'entity keys'
][
'label'
])
&&
isset
(
$entity
->
{
$info
[
'entity keys'
][
'label'
]}))
{
$label
=
$entity
->
{
$info
[
'entity keys'
][
'label'
]};
...
...
modules/field/tests/field_test.module
View file @
38311dc9
...
...
@@ -225,13 +225,15 @@ function field_test_dummy_field_storage_query(EntityFieldQuery $query) {
/**
* Entity label callback.
*
* @param $entity_type
* The entity type.
* @param $entity
* The entity object.
*
* @return
* The label of the entity prefixed with "label callback".
*/
function
field_test_entity_label_callback
(
$entity
)
{
function
field_test_entity_label_callback
(
$entity_type
,
$entity
)
{
return
'label callback '
.
$entity
->
ftlabel
;
}
...
...
modules/system/system.api.php
View file @
38311dc9
...
...
@@ -87,16 +87,16 @@ function hook_hook_info_alter(&$hooks) {
* - uri callback: A function taking an entity as argument and returning the
* uri elements of the entity, e.g. 'path' and 'options'. The actual entity
* uri can be constructed by passing these elements to url().
* - label callback: (optional) A function taking an entity
as argument and
* returning the label of the entity. 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 entity_label() function, which
implements this
* logic.
* - label callback: (optional) A function taking an entity
type and an entity
*
as arguments and
returning the label of the entity. 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 entity_label() function, which
*
implements this
logic.
* - fieldable: Set to TRUE if you want your entity type to accept fields
* being attached to it.
* - translation: An associative array of modules registered as field
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment