summaryrefslogtreecommitdiff
path: root/modules/field/field.api.php
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-11 00:03:42 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-11 00:03:42 +0000
commit7cc3d92d65cccf7e09943312b7fa28642372d4c9 (patch)
tree0bc09ca5d76dc48f67935304bb1a9c24c0ea8b73 /modules/field/field.api.php
parent3b21e82a3770c61ad64062204c33911c42e19d7e (diff)
downloadbrdo-7cc3d92d65cccf7e09943312b7fa28642372d4c9.tar.gz
brdo-7cc3d92d65cccf7e09943312b7fa28642372d4c9.tar.bz2
#616240 follow-up by yched, dereine, marvil07: Make Field UI screens extensible from contrib - part II.
Diffstat (limited to 'modules/field/field.api.php')
-rw-r--r--modules/field/field.api.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index 9b2d3bb4f..2b99c2309 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -2066,6 +2066,33 @@ function hook_field_storage_pre_update($entity_type, $entity, &$skip_fields) {
}
/**
+ * Returns the maximum weight for the entity components handled by the module.
+ *
+ * Field API takes care of fields and 'extra_fields'. This hook is intended for
+ * third-party modules adding other entity components (e.g. field_group).
+ *
+ * @param $entity_type
+ * The type of entity; e.g. 'node' or 'user'.
+ * @param $bundle
+ * The bundle name.
+ * @param $context
+ * The context for which the maximum weight is requested. Either 'form', or
+ * the name of a view mode.
+ * @return
+ * The maximum weight of the entity's components, or NULL if no components
+ * were found.
+ */
+function hook_field_info_max_weight($entity_type, $bundle, $context) {
+ $weights = array();
+
+ foreach (my_module_entity_additions($entity_type, $bundle, $context) as $addition) {
+ $weights[] = $addition['weight'];
+ }
+
+ return $weights ? max($weights) : NULL;
+}
+
+/**
* Alters the display settings of a field before it gets displayed.
*
* Note that instead of hook_field_display_alter(), which is called for all