Created
November 11, 2014 14:54
-
-
Save RoySegall/2a7b911c980152fe605f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_field_info_alter(). | |
* | |
* Adding entity metadata wrapper support for the image field crop module. | |
*/ | |
function os_profiles_field_info_alter(&$info) { | |
$info['imagefield_crop'] += array( | |
'property_type' => 'field_item_image', | |
'property_callbacks' => array('nader'), | |
); | |
} | |
/** | |
* Additional callback to adapt the property info for file fields. | |
* @see entity_metadata_field_entity_property_info(). | |
*/ | |
function nader(&$info, $entity_type, $field, $instance, $field_type) { | |
$property = &$info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']]; | |
// Define a data structure so it's possible to deal with files and their | |
// descriptions. | |
$property['getter callback'] = 'entity_metadata_field_verbatim_get'; | |
$property['setter callback'] = 'entity_metadata_field_verbatim_set'; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment