summaryrefslogtreecommitdiff
path: root/modules/field/field.info.inc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/field/field.info.inc')
-rw-r--r--modules/field/field.info.inc61
1 files changed, 61 insertions, 0 deletions
diff --git a/modules/field/field.info.inc b/modules/field/field.info.inc
index 79a756766..fbc52528e 100644
--- a/modules/field/field.info.inc
+++ b/modules/field/field.info.inc
@@ -700,6 +700,67 @@ function field_info_instance($entity_type, $field_name, $bundle_name) {
}
/**
+ * Returns a list and settings of pseudo-field elements in a given bundle.
+ *
+ * If $context is 'form', an array with the following structure:
+ * @code
+ * array(
+ * 'name_of_pseudo_field_component' => array(
+ * 'label' => The human readable name of the component,
+ * 'description' => A short description of the component content,
+ * 'weight' => The weight of the component in edit forms,
+ * ),
+ * 'name_of_other_pseudo_field_component' => array(
+ * // ...
+ * ),
+ * );
+ * @endcode
+ *
+ * If $context is 'display', an array with the following structure:
+ * @code
+ * array(
+ * 'name_of_pseudo_field_component' => array(
+ * 'label' => The human readable name of the component,
+ * 'description' => A short description of the component content,
+ * // One entry per view mode, including the 'default' mode:
+ * 'display' => array(
+ * 'default' => array(
+ * 'weight' => The weight of the component in displayed entities in
+ * this view mode,
+ * 'visibility' => Whether the component is visible or hidden in
+ * displayed entities in this view mode,
+ * ),
+ * 'teaser' => array(
+ * // ...
+ * ),
+ * ),
+ * ),
+ * 'name_of_other_pseudo_field_component' => array(
+ * // ...
+ * ),
+ * );
+ * @endcode
+ *
+ * @param $entity_type
+ * The type of entity; e.g. 'node' or 'user'.
+ * @param $bundle
+ * The bundle name.
+ * @param $context
+ * The context for which the list of pseudo-fields is requested. Either
+ * 'form' or 'display'.
+ *
+ * @return
+ * The array of pseudo-field elements in the bundle.
+ */
+function field_info_extra_fields($entity_type, $bundle, $context) {
+ $info = _field_info_collate_fields();
+ if (isset($info['extra_fields'][$entity_type][$bundle][$context])) {
+ return $info['extra_fields'][$entity_type][$bundle][$context];
+ }
+ return array();
+}
+
+/**
* Returns a field type's default settings.
*
* @param $type