summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorJennifer Hodgdon <yahgrp@poplarware.com>2012-07-17 16:27:20 -0700
committerJennifer Hodgdon <yahgrp@poplarware.com>2012-07-17 16:27:20 -0700
commitd905b734620cf952f6feb3119542e4d2d9fa373d (patch)
tree4ee2487a77e18653a06b67739ff09e4f5ce0a8a7 /modules
parent7a7abd77b47bb1f92ef4380502e071f840db9280 (diff)
downloadbrdo-d905b734620cf952f6feb3119542e4d2d9fa373d.tar.gz
brdo-d905b734620cf952f6feb3119542e4d2d9fa373d.tar.bz2
Issue #1681456 by mjonesdinero: Move hook_field_widget_properties_alter to correct group
Diffstat (limited to 'modules')
-rw-r--r--modules/field/field.api.php64
1 files changed, 32 insertions, 32 deletions
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index f047cbc1a..0d01c59fa 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -935,6 +935,38 @@ function hook_field_widget_WIDGET_TYPE_form_alter(&$element, &$form_state, $cont
}
/**
+ * Alters the widget properties of a field instance before it gets displayed.
+ *
+ * Note that instead of hook_field_widget_properties_alter(), which is called
+ * for all fields on all entity types,
+ * hook_field_widget_properties_ENTITY_TYPE_alter() may be used to alter widget
+ * properties for fields on a specific entity type only.
+ *
+ * This hook is called once per field per added or edit entity. If the result
+ * of the hook involves reading from the database, it is highly recommended to
+ * statically cache the information.
+ *
+ * @param $widget
+ * The instance's widget properties.
+ * @param $context
+ * An associative array containing:
+ * - entity_type: The entity type; e.g., 'node' or 'user'.
+ * - entity: The entity object.
+ * - field: The field that the widget belongs to.
+ * - instance: The instance of the field.
+ *
+ * @see hook_field_widget_properties_ENTITY_TYPE_alter()
+ */
+function hook_field_widget_properties_alter(&$widget, $context) {
+ // Change a widget's type according to the time of day.
+ $field = $context['field'];
+ if ($context['entity_type'] == 'node' && $field['field_name'] == 'field_foo') {
+ $time = date('H');
+ $widget['type'] = $time < 12 ? 'widget_am' : 'widget_pm';
+ }
+}
+
+/**
* Flag a field-level validation error.
*
* @param $element
@@ -2327,38 +2359,6 @@ function hook_field_extra_fields_display_alter(&$displays, $context) {
}
/**
- * Alters the widget properties of a field instance before it gets displayed.
- *
- * Note that instead of hook_field_widget_properties_alter(), which is called
- * for all fields on all entity types,
- * hook_field_widget_properties_ENTITY_TYPE_alter() may be used to alter widget
- * properties for fields on a specific entity type only.
- *
- * This hook is called once per field per added or edit entity. If the result
- * of the hook involves reading from the database, it is highly recommended to
- * statically cache the information.
- *
- * @param $widget
- * The instance's widget properties.
- * @param $context
- * An associative array containing:
- * - entity_type: The entity type; e.g., 'node' or 'user'.
- * - entity: The entity object.
- * - field: The field that the widget belongs to.
- * - instance: The instance of the field.
- *
- * @see hook_field_widget_properties_ENTITY_TYPE_alter()
- */
-function hook_field_widget_properties_alter(&$widget, $context) {
- // Change a widget's type according to the time of day.
- $field = $context['field'];
- if ($context['entity_type'] == 'node' && $field['field_name'] == 'field_foo') {
- $time = date('H');
- $widget['type'] = $time < 12 ? 'widget_am' : 'widget_pm';
- }
-}
-
-/**
* Alters the widget properties of a field instance on a given entity type
* before it gets displayed.
*