Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
303
Merge Requests
303
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
6d13ffa4
Commit
6d13ffa4
authored
Dec 08, 2010
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#977346
by jhodgdon, joachim: Fixed More detailed docs for entity_label
parent
1d9e77a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
includes/common.inc
includes/common.inc
+6
-3
modules/system/system.api.php
modules/system/system.api.php
+13
-8
No files found.
includes/common.inc
View file @
6d13ffa4
...
...
@@ -7464,13 +7464,16 @@ function entity_uri($entity_type, $entity) {
/**
* Returns the label of an entity.
*
* See the 'label callback' component of the hook_entity_info() return value
* for more information.
*
* @param $entity_type
* The entity type; e.g. 'node' or 'user'.
* The entity type; e.g.
,
'node' or 'user'.
* @param $entity
* The entity for which to generate
a path
.
* The entity for which to generate
the label
.
*
* @return
*
A string with the entity label (e.g. node title)
, or FALSE if not found.
*
The entity label
, or FALSE if not found.
*/
function
entity_label
(
$entity_type
,
$entity
)
{
$label
=
FALSE
;
...
...
modules/system/system.api.php
View file @
6d13ffa4
...
...
@@ -88,10 +88,15 @@ function hook_hook_info_alter(&$hooks) {
* 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; e.g., $node->title or
* $comment->subject. A callback should be specified when the label is the
* result of complex logic. Otherwise, the 'label' property of the
* 'entity keys' the property should be used.
* 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 be fieldable.
* - translation: An associative array of modules registered as field
* translation handlers. Array keys are the module names, array values
...
...
@@ -112,11 +117,11 @@ function hook_hook_info_alter(&$hooks) {
* omitted if this entity type exposes a single bundle (all entities have
* the same collection of fields). The name of this single bundle will be
* the same as the entity type.
* - label: The
property name of the entity that contains the
label. For
* - label: The
name of the property that contains the entity
label. For
* example, if the entity's label is located in $entity->subject, then
* 'sub
ect' should be specified here. In case
complex logic is required to
* build the label, a 'label callback' should be
implemented instead. S
ee
*
entity_label() for details
.
* 'sub
ject' should be specified here. If
complex logic is required to
* build the label, a 'label callback' should be
defined instead (s
ee
*
the 'label callback' section above for details)
.
* - bundle keys: An array describing how the Field API can extract the
* information it needs from the bundle objects for this type (e.g
* $vocabulary objects for terms; not applicable for nodes). This entry can
...
...
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