diff --git a/core/includes/common.inc b/core/includes/common.inc index f8a54e9..5f52de1 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2007,7 +2007,21 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL // Call date_format(). $settings = array('langcode' => $langcode); - return $date_time->format($format, $settings); + $formatted_date = $date_time->format($format, $settings); + + $context = array( + 'settings' => $settings, + 'date_time' => $date_time, + 'timezones' => $timezones, + 'timestamp' => $timestamp, + 'type' => $type, + 'format' => $format, + 'timezone' => $timezone, + 'langcode' => $langcode, + ); + drupal_alter('format_date', $formatted_date, $context); + + return $formatted_date; } /** diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index e9c0860..0568138 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -3946,6 +3946,29 @@ function hook_filetransfer_info_alter(&$filetransfer_info) { } /** + * Alter the formatted date. + * + * A module may implement this hook in order to alter the formatted date string + * + * @param $formatted_date + * Formatted date in string. + * @param $context + * Array of format_date function arguments and defined variables . + * - settings + * - date_time + * - timezones + * - timestamp + * - type + * - format + * - timezone + * - langcode + * @see format_date() + */ +function hook_format_date_alter(&$formatted_date, array $context) { + $formatted_date .= ' ' . $context['timezone']; +} + +/** * @} End of "addtogroup hooks". */