Alters the widget properties of a field instance on a given entity type before it gets displayed.
Modules can implement hook_field_widget_properties_ENTITY_TYPE_alter() to alter the widget properties for fields on a specific entity type, rather than implementing hook_field_widget_properties_alter().
This hook is called once per field per displayed widget entity. If the result of the hook involves reading from the database, it is highly recommended to statically cache the information.
$widget: The instance's widget properties.
$context: An associative array containing:
hook_field_widget_properties_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_field_widget_properties_ENTITY_TYPE_alter(&$widget, $context) {
// Change a widget's type according to the time of day.
$field = $context['field'];
if ($field['field_name'] == 'field_foo') {
$time = date('H');
$widget['type'] = $time < 12 ? 'widget_am' : 'widget_pm';
}
}