function link_field_property_info_callback in Link 7
Additional callback to adapt the property info of link fields.
See also
entity_metadata_field_entity_property_info()
1 string reference to 'link_field_property_info_callback'
- link_field_info in ./
link.module - Implements hook_field_info().
File
- ./
link.module, line 1956 - Defines simple link field types.
Code
function link_field_property_info_callback(&$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 both the link title
// and URL.
$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'] = 'link_field_item_create';
$property['property info'] = link_field_item_property_info();
$property['property info']['url']['required'] = $instance['required'] && !$instance['settings']['url'];
$property['property info']['title']['required'] = $instance['required'] && $instance['settings']['title'] == 'required';
if ($instance['settings']['title'] == 'none') {
unset($property['property info']['title']);
}
unset($property['query callback']);
}