You are here

function phone_field_create_instance in Phone 7.2

Implements hook_field_create_instance().

File

./phone.module, line 1112
The phone module lets administrators use a phone number field type.

Code

function phone_field_create_instance($instance) {
  $field_name = $instance['field_name'];
  $field = field_info_field($field_name);
  if ($field['type'] == 'phone' && module_exists('rdf')) {
    $mapping = rdf_mapping_load($instance['entity_type'], $instance['bundle']);
    if (!isset($mapping[$field_name])) {
      $phone_mapping = _phone_rdf_mapping($instance['entity_type'], $instance['bundle'], $field_name);
      $mapping[$field_name] = $phone_mapping['mapping'][$field_name];
      $mapping_info = array(
        'mapping' => $mapping,
        'type' => $instance['entity_type'],
        'bundle' => $instance['bundle'],
      );
      rdf_mapping_save($mapping_info);
    }
  }
}