Same name and namespace in other branches
  1. 7.x-1.x color_field.module \color_field_property_info_callback() 1 comment

Additional callback to adapt the property info of link fields.

See also

entity_metadata_field_entity_property_info()

1 string reference to 'color_field_property_info_callback'
color_field_field_info in ./color_field.field.inc
Implements hook_field_info().

File

./color_field.field.inc, line 58

Code

function color_field_property_info_callback(&$info, $entity_type, $field, $instance, $field_type) {
    $field_settings = $field['settings'];
    $property =& $info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];
    // Define a data structure so it's possible to deal with both the color
    // and opacity.
    $property['getter callback'] = 'entity_metadata_field_verbatim_get';
    $property['setter callback'] = 'entity_metadata_field_verbatim_set';
    // Auto-create the field item as soon as a property is set.
    $property['auto creation'] = 'color_field_item_create';
    $property['property info'] = color_field_item_property_info();
    if (!$field_settings['opacity']) {
        unset($property['property info']['opacity']);
    }
    unset($property['query callback']);
}