summaryrefslogtreecommitdiff
path: root/modules/field/field.api.php
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-06-30 03:12:03 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-06-30 03:12:03 +0000
commit5b17c1eb04fd09adcc9dc2b5d0fbd6aabe027252 (patch)
tree50fd8a9e0577be020af9e3a682858fc8233093ad /modules/field/field.api.php
parent6d5d8dccc4fabd7f995d2e866e9029407ed62c8a (diff)
downloadbrdo-5b17c1eb04fd09adcc9dc2b5d0fbd6aabe027252.tar.gz
brdo-5b17c1eb04fd09adcc9dc2b5d0fbd6aabe027252.tar.bz2
#502522 by yched: Allow drupal_alter() on various Field API meta-hooks.
Diffstat (limited to 'modules/field/field.api.php')
-rw-r--r--modules/field/field.api.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index 27ae70543..48eb5005e 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -54,6 +54,19 @@ function hook_fieldable_info() {
}
/**
+ * Perform alterations on fieldable types.
+ *
+ * @param $info
+ * Array of informations on fieldable types exposed by hook_fieldable_info()
+ * implementations.
+ */
+function hook_fieldable_info_alter(&$info) {
+ // A contributed module handling node-level caching would want to disable
+ // field cache for nodes.
+ $info['node']['cacheable'] = FALSE;
+}
+
+/**
* @} End of "ingroup field_fieldable_type"
*/
@@ -115,6 +128,25 @@ function hook_field_info() {
}
/**
+ * Perform alterations on Field API field types.
+ *
+ * @param $info
+ * Array of informations on widget types exposed by hook_field_info()
+ * implementations.
+ */
+function hook_field_info_alter(&$info) {
+ // Add a setting to all field types.
+ foreach ($info as $field_type => $field_type_info) {
+ $info[$field_type]['settings'][] = array('mymodule_additional_setting' => 'default value');
+ }
+
+ // Change the default widget for fields of type 'foo'.
+ if (isset($info['foo'])) {
+ $info['foo']['default widget'] = 'mymodule_widget';
+ }
+}
+
+/**
* Define the Field API schema for a field structure.
*
* @param $field
@@ -186,6 +218,21 @@ function hook_field_schema($field) {
function hook_field_widget_info() {
}
+/**
+ * Perform alterations on Field API widget types.
+ *
+ * @param $info
+ * Array of informations on widget types exposed by hook_field_widget_info()
+ * implementations.
+ */
+function hook_field_widget_info_alter(&$info) {
+ // Add a setting to a widget type.
+ $info['text_textfield']['settings'][] = array('mymodule_additional_setting' => 'default value');
+
+ // Let a new field type re-use an existing widget.
+ $info['options_select']['field types'][] = 'my_field_type';
+}
+
/*
* Define Field API formatter types.
*
@@ -201,6 +248,21 @@ function hook_field_formatter_info() {
}
/**
+ * Perform alterations on Field API formatter types.
+ *
+ * @param $info
+ * Array of informations on widget types exposed by
+ * hook_field_field_formatter_info() implementations.
+ */
+function hook_field_formatter_info_alter(&$info) {
+ // Add a setting to a formatter type.
+ $info['text_default']['settings'][] = array('mymodule_additional_setting' => 'default value');
+
+ // Let a new field type re-use an existing formatter.
+ $info['text_default']['field types'][] = 'my_field_type';
+}
+
+/**
* Define custom load behavior for this module's field types.
*
* Unlike other field hooks, this hook operates on multiple objects. The