Commit 2babf5fb authored by webchick's avatar webchick

Issue #1987818 by jlbellido, MattDanger, disasm, vijaycs85: Convert...

Issue #1987818 by jlbellido, MattDanger, disasm, vijaycs85: Convert system_date_format_language_overview_page() to a new style controller.
parent dd20ffdd
<?php
/**
* @file
* Contains \Drupal\system\Controller\LanguageDateFormatController.
*/
namespace Drupal\system\Controller;
/**
* Controller for Language Date Format handling.
*/
class DateFormatLanguageController {
/**
* Displays edit date format links for each language.
*
* @return array
* Render array of overview page.
*/
public function overviewPage() {
$header = array(t('Language'), t('Operations'));
$languages = language_list();
foreach ($languages as $langcode => $language) {
$row = array();
$row[] = $language->name;
$links = array();
$links['edit'] = array(
'title' => t('Edit'),
'href' => 'admin/config/regional/date-time/locale/' . $langcode . '/edit',
);
$links['reset'] = array(
'title' => t('Reset'),
'href' => 'admin/config/regional/date-time/locale/' . $langcode . '/reset',
);
$row[] = array(
'data' => array(
'#type' => 'operations',
'#links' => $links,
),
);
$rows[] = $row;
}
return array('#theme' => 'table', '#header' => $header, '#rows' => $rows);
}
}
......@@ -769,39 +769,6 @@ function theme_system_themes_page($variables) {
return $output;
}
/**
* Page callback: Displays edit date format links for each language.
*
* @see locale_menu()
*/
function system_date_format_language_overview_page() {
$header = array(t('Language'), t('Operations'));
$languages = language_list();
foreach ($languages as $langcode => $language) {
$row = array();
$row[] = $language->name;
$links = array();
$links['edit'] = array(
'title' => t('Edit'),
'href' => "admin/config/regional/date-time/locale/$langcode/edit",
);
$links['reset'] = array(
'title' => t('Reset'),
'href' => "admin/config/regional/date-time/locale/$langcode/reset",
);
$row[] = array(
'data' => array(
'#type' => 'operations',
'#links' => $links,
),
);
$rows[] = $row;
}
return theme('table', array('header' => $header, 'rows' => $rows));
}
/**
* Form constructor for the date localization configuration form.
*
......
......@@ -930,11 +930,9 @@ function system_menu() {
$items['admin/config/regional/date-time/locale'] = array(
'title' => 'Localize',
'description' => 'Configure date formats for each locale',
'page callback' => 'system_date_format_language_overview_page',
'access arguments' => array('administer site configuration'),
'type' => MENU_LOCAL_TASK,
'weight' => -8,
'file' => 'system.admin.inc',
'route_name' => 'date_format_language_overview',
);
$items['admin/config/regional/date-time/locale/%/edit'] = array(
'title' => 'Localize date formats',
......
......@@ -117,6 +117,13 @@ date_format_edit:
requirements:
_entity_access: 'date_format.update'
date_format_language_overview:
pattern: '/admin/config/regional/date-time/locale'
defaults:
_controller: '\Drupal\system\Controller\DateFormatLanguageController::overviewPage'
requirements:
_permission: 'administer site configuration'
date_format_delete:
pattern: 'admin/config/regional/date-time/formats/manage/{date_format}/delete'
defaults:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment