drupal/core/modules/email/email.module

47 lines
2.1 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 allows you to create fields that contain e-mail addresses. See the <a href="@field">Field module help</a> and the <a href="@field_ui">Field UI help</a> pages for general information on fields and how to create and manage them. For more information, see the <a href="@email_documentation">online documentation for the E-mail module</a>.', array('@field' => url('admin/help/field'), '@field_ui' => url('admin/help/field_ui'), '@email_documentation' => 'https://drupal.org/documentation/modules/email')) . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Managing and displaying email fields') . '</dt>';
$output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the email field can be configured separately. See the <a href="@field_ui">Field UI help</a> for more information on how to manage fields and their display.', array('@field_ui' => url('admin/help/field_ui'))) . '</dd>';
$output .= '<dt>' . t('Displaying e-mail addresses as links') . '</dt>';
$output .= '<dd>' . t('E-mail addresses can be displayed as <em>plain text</em> or as <em>links</em> by choosing the appropriate display format.') . '</dd>';
$output .= '<dt>' . t('Validating E-mail addresses') . '</dt>';
$output .= '<dd>' . t('E-mail addresses are validated when the content is saved.') . '</dd>';
$output .= '</dl>';
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';
}
}