It looks like you want to have one more custom field formatter. In order to create a custom field formatter all we need is implementation of 2 hooks
so code will be like this
/**
* Implements hook_field_formatter_info().
*
*/
function mymodule_field_formatter_info() {
// Add a setting to a formatter type.
$formats = array(
'email_custom' => array(
'label' => t('Email Custom'),
'description' => t('Display the email address as custom format.'),
'field types' => array('email'),
),
);
return $formats;
}
/**
* Implements hook_field_formatter_view().
*/
function mymodule_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
switch ($display['type']) {
case 'email_custom':
foreach ($items as $delta => $item) {
$output = l("email", 'mailto:' . $item['email']);
$element[$delta] = array('#markup' => $output);
}
break;
}
return $element;
}
after adding this codes to your custom module clear the caches and you will see one more field formatter as Email Custom(you can change the labels in above code). Now your configurations in manage display for this field will be .
- Hide your field label
- Select Email Custom as field format