annotate core/modules/telephone/telephone.module @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents af1871eacc83
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /**
Chris@0 4 * @file
Chris@0 5 * Defines a simple telephone number field type.
Chris@0 6 */
Chris@0 7
Chris@18 8 use Drupal\Core\Url;
Chris@0 9 use Drupal\Core\Routing\RouteMatchInterface;
Chris@0 10
Chris@0 11 /**
Chris@0 12 * Implements hook_help().
Chris@0 13 */
Chris@0 14 function telephone_help($route_name, RouteMatchInterface $route_match) {
Chris@0 15 switch ($route_name) {
Chris@0 16 case 'help.page.telephone':
Chris@0 17 $output = '';
Chris@0 18 $output .= '<h3>' . t('About') . '</h3>';
Chris@18 19 $output .= '<p>' . t('The Telephone module allows you to create fields that contain telephone numbers. 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=":telephone_documentation">online documentation for the Telephone module</a>.', [':field' => Url::fromRoute('help.page', ['name' => 'field'])->toString(), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? Url::fromRoute('help.page', ['name' => 'field_ui'])->toString() : '#', ':telephone_documentation' => 'https://www.drupal.org/documentation/modules/telephone']) . '</p>';
Chris@0 20 $output .= '<h3>' . t('Uses') . '</h3>';
Chris@0 21 $output .= '<dl>';
Chris@0 22 $output .= '<dt>' . t('Managing and displaying telephone fields') . '</dt>';
Chris@18 23 $output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the telephone 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.', [':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? Url::fromRoute('help.page', ['name' => 'field_ui'])->toString() : '#']) . '</dd>';
Chris@0 24 $output .= '<dt>' . t('Displaying telephone numbers as links') . '</dt>';
Chris@0 25 $output .= '<dd>' . t('Telephone numbers can be displayed as links with the scheme name <em>tel:</em> by choosing the <em>Telephone</em> display format on the <em>Manage display</em> page. Any spaces will be stripped out of the link text. This semantic markup improves the user experience on mobile and assistive technology devices.') . '</dd>';
Chris@0 26 $output .= '</dl>';
Chris@0 27 return $output;
Chris@0 28 }
Chris@0 29 }
Chris@0 30
Chris@0 31 /**
Chris@0 32 * Implements hook_field_formatter_info_alter().
Chris@0 33 */
Chris@0 34 function telephone_field_formatter_info_alter(&$info) {
Chris@0 35 $info['string']['field_types'][] = 'telephone';
Chris@0 36 }