summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-11 06:03:12 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-11 06:03:12 +0000
commitb06d19e34957bd3e719dfcff9e6d180ea95330e5 (patch)
tree495a089976fe40c9cf2389066e3fafbb0d2381ab /modules/system
parentf096a70e67a75e30dafd3e15448b579bfb1909c2 (diff)
downloadbrdo-b06d19e34957bd3e719dfcff9e6d180ea95330e5.tar.gz
brdo-b06d19e34957bd3e719dfcff9e6d180ea95330e5.tar.bz2
#629484 by Amitaibu, fago, et al: Added Add entity 'label' key info (e.g. title on node).
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.api.php10
-rw-r--r--modules/system/system.module1
2 files changed, 11 insertions, 0 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index c9b140167..a7720f145 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -87,6 +87,11 @@ 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; 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.
* - 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
@@ -107,6 +112,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
+ * example, if the entity's label is located in $entity->subject, then
+ * 'subect' should be specified here. In case complex logic is required to
+ * build the label, a 'label callback' should be implemented instead. See
+ * entity_label() 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
diff --git a/modules/system/system.module b/modules/system/system.module
index f0cab512c..21b2f79ad 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -264,6 +264,7 @@ function system_entity_info() {
'base table' => 'file_managed',
'entity keys' => array(
'id' => 'fid',
+ 'label' => 'filename',
),
'static cache' => FALSE,
),