38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Defines a simple e-mail field type.
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_help().
|
|
*/
|
|
function email_help($path, $arg) {
|
|
switch ($path) {
|
|
case 'admin/help#email':
|
|
$output = '';
|
|
$output .= '<h3>' . t('About') . '</h3>';
|
|
$output .= '<p>' . t('The E-mail module defines a field for storing e-mail addresses, for use with the Field module. E-mail addresses are validated to ensure they match the expected format. See the <a href="@field-help">Field module help page</a> for more information about fields.', array('@field-help' => url('admin/help/field'))) . '</p>';
|
|
return $output;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_field_info_alter().
|
|
*/
|
|
function email_field_info_alter(&$info) {
|
|
if (Drupal::moduleHandler()->moduleExists('text')) {
|
|
$info['email']['default_formatter'] = 'text_plain';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Implements hook_field_formatter_info_alter().
|
|
*/
|
|
function email_field_formatter_info_alter(&$info) {
|
|
if (isset($info['text_plain'])) {
|
|
$info['text_plain']['field_types'][] = 'email';
|
|
}
|
|
}
|