diff --git a/core/modules/system/lib/Drupal/system/Controller/DateTimeController.php b/core/modules/system/lib/Drupal/system/Controller/DateTimeController.php new file mode 100644 index 0000000..ec61eaa --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Controller/DateTimeController.php @@ -0,0 +1,69 @@ + t('Machine name'), 'field' => 'machine_name'), + array('data' => t('Name'), 'field' => 'name'), + array('data' => t('Pattern'), 'field' => 'pattern'), + array('data' => t('Operations')) + ); + $rows = array(); + + $formats = system_get_date_formats(); + + if (!empty($formats)) { + foreach ($formats as $date_format_id => $format_info) { + // Do not display date formats that are locked. + if (empty($format_info['locked'])) { + $row = array(); + $row[] = array('data' => $date_format_id); + $row[] = array('data' => $format_info['name']); + $row[] = array('data' => format_date(REQUEST_TIME, $date_format_id)); + + // Prepare Operational links. + $links = array(); + $links['edit'] = array( + 'title' => t('Edit'), + 'href' => 'admin/config/regional/date-time/formats/' . $date_format_id . '/edit', + ); + $links['delete'] = array( + 'title' => t('Delete'), + 'href' => 'admin/config/regional/date-time/formats/' . $date_format_id . '/delete', + ); + $row['operations'] = array('data' => array( + '#type' => 'operations', + '#links' => $links, + )); + + $rows[] = $row; + } + } + } + + $build['date_formats_table'] = array( + '#theme' => 'table', + '#header' => $header, + '#rows' => $rows, + '#empty' => t('No custom date formats available. Add date format.', array('@link' => url('admin/config/regional/date-time/formats/add'))), + ); + + return $build; + } +} \ No newline at end of file diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 0d472e5..7568ee9 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -880,10 +880,8 @@ function system_menu() { $items['admin/config/regional/date-time'] = array( 'title' => 'Date and time formats', 'description' => 'Configure display format strings for date and time.', - 'page callback' => 'system_date_time_formats', - 'access arguments' => array('administer site configuration'), - 'weight' => -9, - 'file' => 'system.admin.inc', + 'route_name' => 'system_date_time_formats', + 'weights' => -9, ); $items['admin/config/regional/date-time/formats/add'] = array( 'title' => 'Add format', diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index 9859d6a..3380a3f 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -87,3 +87,10 @@ date_format_localize_reset: _form: '\Drupal\system\Form\DateFormatLocalizeResetForm' requirements: _permission: 'administer site configuration' + +system_date_time_formats: + pattern: 'admin/config/regional/date-time' + defaults: + _content: '\Drupal\system\Controller\DateTimeController::formats' + requirements: + _permission: 'administer site configuration' \ No newline at end of file