You are here

function phonefield_field_property_info_callback in Phone Field 7

Additional callback to adapt the property info of phonefield fields.

See also

entity_metadata_field_entity_property_info()

1 string reference to 'phonefield_field_property_info_callback'
phonefield_field_info in ./phonefield.module
Implements hook_field_info().

File

./phonefield.module, line 77
Hooks for a module that defines a simple phone number field type.

Code

function phonefield_field_property_info_callback(&$info, $entity_type, $field, $instance, $field_type) {
  $property =& $info[$entity_type]['bundles'][$instance['bundle']]['properties'][$field['field_name']];
  $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'] = 'phonefield_field_item_create';
  $property['property info'] = array(
    'phonenumber' => array(
      'type' => 'text',
      'label' => t('The phone number.'),
      'setter callback' => 'entity_property_verbatim_set',
    ),
  );
  if ($instance['settings']['linkstate'] != 'none') {
    $property['property info']['linklabel'] = array(
      'type' => 'text',
      'label' => t('Phone link label.'),
      'setter callback' => 'entity_property_verbatim_set',
    );
  }
  unset($property['query callback']);
}