diff --git a/core/modules/system/lib/Drupal/system/Controller/DateTimeController.php b/core/modules/system/lib/Drupal/system/Controller/DateTimeController.php index a1ffc0e..82df586 100644 --- a/core/modules/system/lib/Drupal/system/Controller/DateTimeController.php +++ b/core/modules/system/lib/Drupal/system/Controller/DateTimeController.php @@ -7,12 +7,28 @@ namespace Drupal\system\Controller; +use Drupal\Core\Controller\ControllerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Route controller class for the date and time formats. + * + * @todo "DateTimeController" seems like too generic of a name for this class. */ -class DateTimeController { +class DateTimeController implements ControllerInterface { + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static(); + } + + /** + * Constructs a DateTimeController object. + */ + public function __construct() { + } /** * Displays the date format strings overview page. @@ -29,7 +45,7 @@ public function formats() { ); $rows = array(); - $formats = system_get_date_formats(); + $formats = $this->getDateFormats(); if (!empty($formats)) { foreach ($formats as $date_format_id => $format_info) { @@ -64,9 +80,23 @@ public function formats() { '#theme' => 'table', '#header' => $header, '#rows' => $rows, + // @todo Replace url() with the url generator service once the path + // admin/config/regional/date-time/formats/add is converted. '#empty' => t('No custom date formats available. Add date format.', array('@link' => url('admin/config/regional/date-time/formats/add'))), ); return $build; } + + /** + * Get the date formats out of the configuration system. + */ + protected function getDateFormats() { + // @todo, Crell suggests replacing the direct usage of system_get_date_formats() + // with this protected method that gets the config system out of the container + // and then does the same task as system_get_date_formats(). I'm not sure + // If that should be done now or in a bulk replacement of system_get_date_formats() + // everywhere. + return system_get_date_formats(); + } }