function mobile_number_property_callback in Mobile Number 7
Additional callback to adapt the property info for mobile number fields.
See also
entity_metadata_field_entity_property_info()
1 string reference to 'mobile_number_property_callback'
- mobile_number_field_info in ./
mobile_number.module - Implements hook_field_info().
File
- ./
mobile_number.module, line 83 - mobile_number.module
Code
function mobile_number_property_callback(&$info, $entity_type, $field, $instance, $field_type) {
// Define a data structure for dealing with mobile number fields.
$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';
unset($property['query callback']);
$property['type'] = $field['cardinality'] != 1 ? 'list' : 'text';
$property['property info'] = array(
'value' => array(
'type' => 'text',
'label' => t('International Number'),
'sanitized' => TRUE,
'getter callback' => 'entity_property_verbatim_get',
'setter callback' => 'entity_property_verbatim_set',
'raw getter callback' => 'entity_property_verbatim_get',
),
'country' => array(
'type' => 'text',
'label' => t('Country'),
'sanitized' => TRUE,
'options list' => 'mobile_number_property_country_options',
'getter callback' => 'entity_property_verbatim_get',
'setter callback' => 'entity_property_verbatim_set',
'raw getter callback' => 'entity_property_verbatim_get',
),
'local_number' => array(
'type' => 'text',
'label' => t('Local Number'),
'sanitized' => TRUE,
'getter callback' => 'entity_property_verbatim_get',
'setter callback' => 'entity_property_verbatim_set',
'raw getter callback' => 'entity_property_verbatim_get',
),
'verified' => array(
'type' => 'boolean',
'label' => t('Verified'),
'sanitized' => TRUE,
'getter callback' => 'entity_property_verbatim_get',
'setter callback' => 'entity_property_verbatim_set',
'raw getter callback' => 'entity_property_verbatim_get',
),
'tfa' => array(
'type' => 'boolean',
'label' => t('TFA'),
'sanitized' => TRUE,
'getter callback' => 'entity_property_verbatim_get',
'setter callback' => 'entity_property_verbatim_set',
'raw getter callback' => 'entity_property_verbatim_get',
),
);
// Enable auto-creation of the item, so that it is possible to just set
// the textual or summary value.
$property['auto creation'] = 'entity_property_create_array';
}