datetime_extras.module in Datetime Extras 8
Hooks for the datetime_extras module.
File
datetime_extras.moduleView source
<?php
/**
 * @file
 * Hooks for the datetime_extras module.
 */
use Drupal\Core\Routing\RouteMatchInterface;
/**
 * Implements hook_help().
 */
function datetime_extras_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.datetime_extras':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Datetime Extras module provides additional functionality to extend the core Datetime and Datetime Range modules.') . '</p>';
      return $output;
  }
}
/**
 * Implements hook_field_widget_info_alter().
 *
 * Remove the daterange_duration widget unless a sufficiently modern version of
 * duration_field module is enabled.
 */
function datetime_extras_field_widget_info_alter(array &$info) {
  if (!method_exists('\\Drupal\\duration_field\\Service\\DurationService', 'convertDateArrayToDateInterval')) {
    // If we don't have 8.x-2.0-rc2 or later, hide the widget.
    unset($info['daterange_duration']);
  }
}Functions
| Name   | Description | 
|---|---|
| datetime_extras_field_widget_info_alter | Implements hook_field_widget_info_alter(). | 
| datetime_extras_help | Implements hook_help(). | 
