diff --git a/core/modules/language/language.local_tasks.yml b/core/modules/language/language.local_tasks.yml index 690d3f897061325956ff87bfa6ca7b6ecaabc39f..fc5f30ce97fab9d222ad92f7e902b78377880470 100644 --- a/core/modules/language/language.local_tasks.yml +++ b/core/modules/language/language.local_tasks.yml @@ -1,9 +1,3 @@ -system.date_format_language_overview: - title: 'Localize' - route_name: system.date_format_language_overview - tab_root_id: system.date_format_list - weight: -8 - language.admin_overview: title: 'List' route_name: language.admin_overview diff --git a/core/modules/language/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php b/core/modules/language/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php index cd3cd2f96eb6774240e11410bf056f7049a28e98..204b8cdffc2e38c68e1d854444cb3004aa1de9ca 100644 --- a/core/modules/language/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php +++ b/core/modules/language/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php @@ -60,14 +60,4 @@ public function testLanguageEditLocalTasks() { )); } - /** - * Tests language date format local tasks. - */ - public function testLanguageDateLocalTasks() { - $this->assertLocalTasks('system.date_format_language_overview', array( - 0 => array('system.date_format_language_overview'), - )); - } - - } diff --git a/core/modules/system/config/schema/system.schema.yml b/core/modules/system/config/schema/system.schema.yml index 020e9d300505482813952189ab9e769d7cdccd0c..857e59f7a9aff4e421c7102181fb1b387b3eee93 100644 --- a/core/modules/system/config/schema/system.schema.yml +++ b/core/modules/system/config/schema/system.schema.yml @@ -130,12 +130,6 @@ system.date_format.*: locked: type: boolean label: 'Locked' - locales: - type: sequence - label: 'Languages' - sequence: - - type: string - label: 'Language' pattern: type: mapping label: 'Format string' diff --git a/core/modules/system/config/system.date_format.fallback.yml b/core/modules/system/config/system.date_format.fallback.yml index 51e0182414c3859e269f03ed25c157b6dfa16702..6e0c242b791467ec5fb790c894b51b37b2fcee4f 100644 --- a/core/modules/system/config/system.date_format.fallback.yml +++ b/core/modules/system/config/system.date_format.fallback.yml @@ -4,7 +4,6 @@ label: 'Fallback date format' status: true langcode: en locked: true -locales: { } pattern: php: 'D, m/d/Y - H:i' intl: 'ccc, MM/dd/yyyy - kk:mm' diff --git a/core/modules/system/config/system.date_format.html_date.yml b/core/modules/system/config/system.date_format.html_date.yml index 50f2509dc3e94e2a49a2484b8cbc2b4aa1c32557..7c81d45f3690a55f150325f13973760a718613b8 100644 --- a/core/modules/system/config/system.date_format.html_date.yml +++ b/core/modules/system/config/system.date_format.html_date.yml @@ -4,7 +4,6 @@ label: 'HTML Date' status: true langcode: en locked: true -locales: { } pattern: php: Y-m-d intl: yyyy-MM-dd diff --git a/core/modules/system/config/system.date_format.html_datetime.yml b/core/modules/system/config/system.date_format.html_datetime.yml index 33fad398dc2470d240faf989d461f57b8f22fddd..fd594fd55c077ba3292618716a18a38cd2e9da8b 100644 --- a/core/modules/system/config/system.date_format.html_datetime.yml +++ b/core/modules/system/config/system.date_format.html_datetime.yml @@ -4,7 +4,6 @@ label: 'HTML Datetime' status: true langcode: en locked: true -locales: { } pattern: php: 'Y-m-d\TH:i:sO' intl: 'yyyy-MM-dd''T''kk:mm:ssZZ' diff --git a/core/modules/system/config/system.date_format.html_month.yml b/core/modules/system/config/system.date_format.html_month.yml index b2c8c6094cf9f349f75fd817b9dee04067df0fab..439ee54e8b5a6a49c1ff43d5a39cee0e4c8d281e 100644 --- a/core/modules/system/config/system.date_format.html_month.yml +++ b/core/modules/system/config/system.date_format.html_month.yml @@ -4,7 +4,6 @@ label: 'HTML Month' status: true langcode: en locked: true -locales: { } pattern: php: Y-m intl: Y-MM diff --git a/core/modules/system/config/system.date_format.html_time.yml b/core/modules/system/config/system.date_format.html_time.yml index d804313ebfc8d0d8885ecf49becfd8f5cd7e2620..cff494c6228d3036c74ee3a5ca785e95045394f2 100644 --- a/core/modules/system/config/system.date_format.html_time.yml +++ b/core/modules/system/config/system.date_format.html_time.yml @@ -4,7 +4,6 @@ label: 'HTML Time' status: true langcode: en locked: true -locales: { } pattern: php: 'H:i:s' intl: 'H:mm:ss' diff --git a/core/modules/system/config/system.date_format.html_week.yml b/core/modules/system/config/system.date_format.html_week.yml index 4258b21861e4fada839759387aa0bc39c09eae21..47720c2613f04abaf40fdc7d824afdf108e85aee 100644 --- a/core/modules/system/config/system.date_format.html_week.yml +++ b/core/modules/system/config/system.date_format.html_week.yml @@ -4,7 +4,6 @@ label: 'HTML Week' status: true langcode: en locked: true -locales: { } pattern: php: Y-\WW intl: 'Y-''W''WW' diff --git a/core/modules/system/config/system.date_format.html_year.yml b/core/modules/system/config/system.date_format.html_year.yml index aaba268eb120aac0ce560bc2428f36e005a6c2bf..fa67489fbf6dad20499a13e18a0bd29f569a4710 100644 --- a/core/modules/system/config/system.date_format.html_year.yml +++ b/core/modules/system/config/system.date_format.html_year.yml @@ -4,7 +4,6 @@ label: 'HTML Year' status: true langcode: en locked: true -locales: { } pattern: php: Y intl: Y diff --git a/core/modules/system/config/system.date_format.html_yearless_date.yml b/core/modules/system/config/system.date_format.html_yearless_date.yml index 221244b2026aeaa67a415640d0bb95a8fb7bf427..420bac60279fdd2dfda21be84289d5c1f9aa04ed 100644 --- a/core/modules/system/config/system.date_format.html_yearless_date.yml +++ b/core/modules/system/config/system.date_format.html_yearless_date.yml @@ -4,7 +4,6 @@ label: 'HTML Yearless date' status: true langcode: en locked: true -locales: { } pattern: php: m-d intl: MM-d diff --git a/core/modules/system/config/system.date_format.long.yml b/core/modules/system/config/system.date_format.long.yml index d9492bc7338664c7c502fdf846aa39ee5952ccad..487458db614c4dd89b62670fdb852d9646f50a86 100644 --- a/core/modules/system/config/system.date_format.long.yml +++ b/core/modules/system/config/system.date_format.long.yml @@ -4,7 +4,6 @@ label: 'Default long date' status: true langcode: en locked: false -locales: { } pattern: php: 'l, F j, Y - H:i' intl: 'EEEE, LLLL d, yyyy - kk:mm' diff --git a/core/modules/system/config/system.date_format.medium.yml b/core/modules/system/config/system.date_format.medium.yml index 82c18f2eb851da172b663006ef37ca79e1adffa7..4d18cb4a99946f0b5bb5c870f4ff590e41757fd7 100644 --- a/core/modules/system/config/system.date_format.medium.yml +++ b/core/modules/system/config/system.date_format.medium.yml @@ -4,7 +4,6 @@ label: 'Default medium date' status: true langcode: en locked: false -locales: { } pattern: php: 'D, m/d/Y - H:i' intl: 'ccc, MM/dd/yyyy - kk:mm' diff --git a/core/modules/system/config/system.date_format.short.yml b/core/modules/system/config/system.date_format.short.yml index bfba9188ccf878a07abead0b2e58a3d29d09f37f..2bf1a4d6c9d2ba7a7b58b5a8c5d28a8f469a8657 100644 --- a/core/modules/system/config/system.date_format.short.yml +++ b/core/modules/system/config/system.date_format.short.yml @@ -4,7 +4,6 @@ label: 'Default short date' status: true langcode: en locked: false -locales: { } pattern: php: 'm/d/Y - H:i' intl: 'MM/dd/yyyy - kk:mm' diff --git a/core/modules/system/lib/Drupal/system/Controller/DateFormatLanguageController.php b/core/modules/system/lib/Drupal/system/Controller/DateFormatLanguageController.php deleted file mode 100644 index 1f97951abf0490f05b80036bbf9883d4a6da9cae..0000000000000000000000000000000000000000 --- a/core/modules/system/lib/Drupal/system/Controller/DateFormatLanguageController.php +++ /dev/null @@ -1,51 +0,0 @@ -<?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); - - } - -} diff --git a/core/modules/system/lib/Drupal/system/DateFormatInterface.php b/core/modules/system/lib/Drupal/system/DateFormatInterface.php index 6801494cbeafecc88bb33126ef3894b735fe422a..7a15cb280c038df3c6513a314130ce072998e131 100644 --- a/core/modules/system/lib/Drupal/system/DateFormatInterface.php +++ b/core/modules/system/lib/Drupal/system/DateFormatInterface.php @@ -39,44 +39,6 @@ public function getPattern($type = DrupalDateTime::PHP); */ public function setPattern($pattern, $type = DrupalDateTime::PHP); - /** - * Adds a locale for this date format. - * - * @param string $locale - * The locale to add for this format. - * - * @return self - * Returns the date format. - */ - public function addLocale($locale); - - /** - * Sets the locales for this date format. This overwrites existing locales. - * - * @param array $locales - * The array of locales to set for this format. - * - * @return self - * Returns the date format. - */ - public function setLocales(array $locales); - - /** - * Returns an array of the locales for this date format. - * - * @return array - * An array of locale names. - */ - public function getLocales(); - - /** - * Determines if this data format has any locales. - * - * @return bool - * TRUE if the date format has locales, FALSE otherwise. - */ - public function hasLocales(); - /** * Determines if this date format is locked. * diff --git a/core/modules/system/lib/Drupal/system/Entity/DateFormat.php b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php index fb4c7d36257bb87381194c7696a1cdd196a8e325..d1dfca2b53694ddd707c1b7c1929e60da937e21c 100644 --- a/core/modules/system/lib/Drupal/system/Entity/DateFormat.php +++ b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php @@ -78,11 +78,6 @@ class DateFormat extends ConfigEntityBase implements DateFormatInterface { */ protected $locked = FALSE; - /** - * @var array - */ - protected $locales = array(); - /** * {@inheritdoc} */ @@ -90,7 +85,6 @@ public function getExportProperties() { $properties = parent::getExportProperties(); $names = array( 'locked', - 'locales', 'pattern', ); foreach ($names as $name) { @@ -114,37 +108,6 @@ public function setPattern($pattern, $type = DrupalDateTime::PHP) { return $this; } - /** - * {@inheritdoc} - */ - public function getLocales() { - return $this->locales; - } - - /** - * {@inheritdoc} - */ - public function setLocales(array $locales) { - $this->locales = $locales; - return $this; - } - - /** - * {@inheritdoc} - */ - public function hasLocales() { - return !empty($this->locales); - } - - /** - * {@inheritdoc} - */ - public function addLocale($locale) { - $this->locales[] = $locale; - $this->locales = array_unique($this->locales); - return $this; - } - /** * {@inheritdoc} */ @@ -152,43 +115,4 @@ public function isLocked() { return (bool) $this->locked; } - /** - * {@inheritdoc} - */ - public function preSave(EntityStorageControllerInterface $storage_controller) { - parent::preSave($storage_controller); - - if ($this->hasLocales()) { - $config_factory = \Drupal::service('config.factory'); - $properties = $this->getExportProperties(); - $languages = language_list(); - // Check if the suggested language codes are configured. - foreach ($this->getLocales() as $langcode) { - if (isset($languages[$langcode])) { - $config_factory->get('locale.config.' . $langcode . '.system.date_format.' . $this->id()) - ->setData($properties) - ->save(); - } - } - } - } - - /** - * {@inheritdoc} - */ - public static function postDelete(EntityStorageControllerInterface $storage_controller, array $entities) { - parent::postDelete($storage_controller, $entities); - - // Clean up the localized entry if required. - if (\Drupal::moduleHandler()->moduleExists('language')) { - $languages = language_list(); - foreach ($entities as $entity) { - $format_id = $entity->id(); - foreach ($languages as $langcode => $data) { - \Drupal::config("locale.config.$langcode.system.date_format.$format_id")->delete(); - } - } - } - } - } diff --git a/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php b/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php index be4c55b930a72f706cad2b063c55455ff40dff69..cc283af22a3a9f531f28c88aa6c2f2e29b376d48 100644 --- a/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php +++ b/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php @@ -11,6 +11,7 @@ use Drupal\Core\Ajax\ReplaceCommand; use Drupal\Core\Config\Entity\ConfigStorageController; use Drupal\Core\Datetime\Date; +use Drupal\Core\Language\Language; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Entity\Query\QueryFactory; @@ -168,22 +169,12 @@ public function form(array $form, array &$form_state) { '#required' => TRUE, ); - $languages = language_list(); - - $options = array(); - foreach ($languages as $langcode => $data) { - $options[$langcode] = $data->name; - } - - if (!empty($options)) { - $form['locales'] = array( - '#title' => t('Languages'), - '#type' => 'select', - '#options' => $options, - '#multiple' => TRUE, - '#default_value' => $this->entity->getLocales(), - ); - } + $form['langcode'] = array( + '#type' => 'language_select', + '#title' => t('Language'), + '#languages' => Language::STATE_ALL, + '#default_value' => $this->entity->langcode, + ); return parent::form($form, $form_state); } diff --git a/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php b/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php deleted file mode 100644 index 6770e18cd1f79c70de05888d15d97a86a91b79eb..0000000000000000000000000000000000000000 --- a/core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\system\Form\DateFormatLocalizeResetForm. - */ - -namespace Drupal\system\Form; - -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Form\ConfirmFormBase; -use Drupal\Core\Config\ConfigFactory; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Builds a form for enabling a module. - */ -class DateFormatLocalizeResetForm extends ConfirmFormBase implements ContainerInjectionInterface { - - /** - * The language to be reset. - * - * @var \Drupal\Core\Language\Language; - */ - protected $language; - - /** - * The config factory. - * - * @var \Drupal\Core\Config\ConfigFactory - */ - protected $configFactory; - - /** - * Constructs a DateFormatLocalizeResetForm object. - * - * @param \Drupal\Core\Config\ConfigFactory $config_factory - * The config factory. - */ - public function __construct(ConfigFactory $config_factory) { - $this->configFactory = $config_factory; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('config.factory') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'system_date_format_localize_reset_form'; - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return t('Are you sure you want to reset the date formats for %language to the global defaults?', array( - '%language' => $this->language->name, - )); - } - - /** - * {@inheritdoc} - */ - public function getConfirmText() { - return t('Reset'); - } - - /** - * {@inheritdoc} - */ - public function getCancelRoute() { - return array( - 'route_name' => 'system.date_format_language_overview', - ); - } - - /** - * {@inheritdoc} - */ - public function getDescription() { - return t('Resetting will remove all localized date formats for this language. This action cannot be undone.'); - } - - /** - * {@inheritdoc} - * - * @param string $langcode - * The language code. - * - */ - public function buildForm(array $form, array &$form_state, $langcode = NULL) { - $this->language = language_load($langcode); - - return parent::buildForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, array &$form_state) { - foreach (config_get_storage_names_with_prefix('locale.config.' . $this->language->id . '.system.date_format.') as $config_id) { - $this->configFactory->get($config_id)->delete(); - } - entity_render_cache_clear(); - - $form_state['redirect'] = 'admin/config/regional/date-time/locale'; - } - -} diff --git a/core/modules/system/lib/Drupal/system/Form/SystemForm.php b/core/modules/system/lib/Drupal/system/Form/SystemForm.php deleted file mode 100644 index 20b64db11601682d9a20e4cbf01600674295d936..0000000000000000000000000000000000000000 --- a/core/modules/system/lib/Drupal/system/Form/SystemForm.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\system\Form\SystemForm. - */ - -namespace Drupal\system\Form; - -/** - * Temporary form controller for system module. - */ -class SystemForm { - - /** - * Wraps system_date_format_localize_form(). - * - * @todo Remove system_date_format_localize_form(). - */ - public function localizeDateFormat($langcode) { - module_load_include('admin.inc', 'system'); - return drupal_get_form('system_date_format_localize_form', $langcode); - } - -} diff --git a/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLanguageTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLanguageTest.php deleted file mode 100644 index 2b63cc95b2201762c5b1232a8e98c36bea1741fb..0000000000000000000000000000000000000000 --- a/core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLanguageTest.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php - -/** - * @file - * Definition of Drupal\system\Tests\System\DateFormatsLanguageTest. - */ - -namespace Drupal\system\Tests\System; - -use Drupal\Core\Language\Language; -use Drupal\simpletest\WebTestBase; - -/** - * Functional tests for localizing date formats. - */ -class DateFormatsLanguageTest extends WebTestBase { - - /** - * Modules to enable. - * - * @var array - */ - public static $modules = array('node', 'locale'); - - public static function getInfo() { - return array( - 'name' => 'Localize date formats', - 'description' => 'Tests for the localization of date formats.', - 'group' => 'System', - ); - } - - function setUp() { - parent::setUp(); - - // Create Article node type. - $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); - - // Create and login user. - $admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer languages', 'access administration pages', 'create article content')); - $this->drupalLogin($admin_user); - } - - /** - * Functional tests for localizing date formats. - */ - function testLocalizeDateFormats() { - // Add language. - $edit = array( - 'predefined_langcode' => 'fr', - ); - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); - - // Set language negotiation. - $language_type = Language::TYPE_INTERFACE; - $edit = array( - "{$language_type}[enabled][language-url]" => TRUE, - ); - $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings')); - - // Add new date format for French. - $edit = array( - 'id' => 'example_style_fr', - 'label' => 'Example Style', - 'date_format_pattern' => 'd.m.Y - H:i', - 'locales[]' => array('fr'), - ); - $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); - - // Add new date format for English. - $edit = array( - 'id' => 'example_style_en', - 'label' => 'Example Style', - 'date_format_pattern' => 'j M Y - g:ia', - 'locales[]' => array('en'), - ); - $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); - - // Configure date formats. - $this->drupalGet('admin/config/regional/date-time/locale'); - $this->assertText('French', 'Configured languages appear.'); - $edit = array( - 'date_format_long' => 'example_style_fr', - 'date_format_medium' => 'example_style_fr', - 'date_format_short' => 'example_style_fr', - ); - $this->drupalPostForm('admin/config/regional/date-time/locale/fr/edit', $edit, t('Save configuration')); - $this->assertText(t('Configuration saved.'), 'French date formats updated.'); - - $edit = array( - 'date_format_long' => 'example_style_en', - 'date_format_medium' => 'example_style_en', - 'date_format_short' => 'example_style_en', - ); - $this->drupalPostForm('admin/config/regional/date-time/locale/en/edit', $edit, t('Save configuration')); - $this->assertText(t('Configuration saved.'), 'English date formats updated.'); - - // Create node content. - $node = $this->drupalCreateNode(array('type' => 'article')); - - // Configure format for the node posted date changes with the language. - $this->drupalGet('node/' . $node->id()); - $english_date = format_date($node->getCreatedTime(), 'custom', 'j M Y'); - $this->assertText($english_date, 'English date format appears'); - $this->drupalGet('fr/node/' . $node->id()); - $french_date = format_date($node->getCreatedTime(), 'custom', 'd.m.Y'); - $this->assertText($french_date, 'French date format appears'); - - // Make sure we can reset dates back to default. - $this->drupalPostForm('admin/config/regional/date-time/locale/en/reset', array(), t('Reset')); - $this->drupalGet('node/' . $node->id()); - $this->assertNoText($english_date, 'English date format does not appear'); - } -} diff --git a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php index dd68a3a7e612be8510fb3828043f5737b244e90e..f00b5ba0a76d0d4beba36251993e7de9e355c7c8 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php @@ -124,28 +124,6 @@ function testDateFormatConfiguration() { $this->assertFalse($date_format); } - /** - * Test if the date formats are stored properly. - */ - function testDateFormatStorage() { - $date_format = entity_create('date_format', array( - 'id' => 'test_short', - 'label' => 'testDateFormatStorage Short Format', - 'pattern' => array('php' => 'dmYHis'), - )); - $date_format->save(); - - $format = $date_format->getPattern(); - $this->assertEqual('dmYHis', $format, 'Unlocalized date format resides in general config.'); - - $date_format->addLocale('en')->save(); - $format = $date_format->getPattern(); - $this->assertEqual('dmYHis', $format, 'Localized date format resides in general config too.'); - - $format = \Drupal::config('locale.config.en.system.date_format.test_short')->get('pattern.php'); - $this->assertEqual('dmYHis', $format, 'Localized date format resides in localized config.'); - } - /** * Test that date formats are sanitized. */ diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index bb8c6b4c7c0c7e40fa0643858d2d2e1e38068ab2..29237fdba97c5c6797b6e944904aef87ed232909 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -779,140 +779,3 @@ function theme_system_themes_page($variables) { return $output; } - -/** - * Form constructor for the date localization configuration form. - * - * @param $langcode - * The code for the current language. - * - * @see locale_menu() - * @see system_date_format_localize_form_submit() - * @ingroup forms - * - * @deprecated Use \Drupal\system\Form\SystemForm::localizeDateFormat() - */ -function system_date_format_localize_form($form, &$form_state, $langcode) { - // Display the current language name. - $form['language'] = array( - '#type' => 'item', - '#title' => t('Language'), - '#markup' => language_load($langcode)->name, - '#weight' => -10, - ); - $form['langcode'] = array( - '#type' => 'value', - '#value' => $langcode, - ); - - // Get list of available formats. - $date_service = \Drupal::service('date'); - $formats = \Drupal::entityManager() - ->getStorageController('date_format') - ->loadMultiple(); - $choices = array(); - foreach ($formats as $date_format_id => $format_info) { - // Ignore values that are localized. - if (!$format_info->hasLocales()) { - $choices[$date_format_id] = $date_service->format(REQUEST_TIME, $date_format_id); - } - } - - // Get configured formats for each language. - $config_prefix = 'locale.config.' . $langcode . '.system.date_format.'; - foreach (config_get_storage_names_with_prefix($config_prefix) as $config_id) { - $date_format_id = substr($config_id, strlen($config_prefix)); - $choices[$date_format_id] = $date_service->format(REQUEST_TIME, $date_format_id); - } - - // Display a form field for each format type. - foreach ($formats as $date_format_id => $format_info) { - // Show date format select list. - $form['date_formats']['date_format_' . $date_format_id] = array( - '#type' => 'select', - '#title' => check_plain($format_info->label()), - '#attributes' => array('class' => array('date-format')), - '#default_value' => isset($choices[$date_format_id]) ? $date_format_id : 'custom', - '#options' => $choices, - ); - } - - $form['actions'] = array('#type' => 'actions'); - $form['actions']['submit'] = array( - '#type' => 'submit', - '#value' => t('Save configuration'), - ); - - return $form; -} - -/** - * Form submission handler for system_date_format_localize_form(). - */ -function system_date_format_localize_form_submit($form, &$form_state) { - $langcode = $form_state['values']['langcode']; - - $formats = entity_load_multiple('date_format'); - foreach ($formats as $date_format_id => $format_info) { - if (isset($form_state['values']['date_format_' . $date_format_id])) { - $format = $form_state['values']['date_format_' . $date_format_id]; - system_date_format_localize_form_save($langcode, $date_format_id, $formats[$format]); - } - } - drupal_set_message(t('Configuration saved.')); - $form_state['redirect'] = 'admin/config/regional/date-time/locale'; -} - -/** - * Returns HTML for a locale date format form. - * - * @param $variables - * An associative array containing: - * - form: A render element representing the form. - * - * @ingroup themeable - */ -function theme_system_date_format_localize_form($variables) { - $form = $variables['form']; - $header = array( - 'machine_name' => t('Machine Name'), - 'pattern' => t('Format'), - ); - - foreach (element_children($form['date_formats']) as $key) { - $row = array(); - $row[] = $form['date_formats'][$key]['#title']; - unset($form['date_formats'][$key]['#title']); - $row[] = array('data' => drupal_render($form['date_formats'][$key])); - $rows[] = $row; - } - - $table = array( - '#theme' => 'table', - '#header' => $header, - '#rows' => $rows, - ); - $output = drupal_render($form['language']); - $output .= drupal_render($table); - $output .= drupal_render_children($form); - - return $output; -} - -/** - * Save locale specific date formats to the database. - * - * @param string $langcode - * Language code, can be 2 characters, e.g. 'en' or 5 characters, e.g. - * 'en-CA'. - * @param string $date_format_id - * Date format id, e.g. 'short', 'medium'. - * @param \Drupal\system\DateFormatInterface $format - * The date format entity. - */ -function system_date_format_localize_form_save($langcode, $date_format_id, DateFormatInterface $format) { - $format->addLocale($langcode)->save(); - \Drupal::config('locale.config.' . $langcode . '.system.date_format.' . $date_format_id) - ->set('pattern', $format->get('pattern')) - ->save(); -} diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 9e2231b3dd455ff91d3abe93191acb71641373cc..71f2860b834c4a780f3f7c51eea91464477886de 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -189,9 +189,6 @@ function system_theme() { 'system_compact_link' => array( 'variables' => array(), ), - 'system_date_format_localize_form' => array( - 'render element' => 'form', - ), )); } @@ -815,26 +812,6 @@ function system_menu() { 'type' => MENU_CALLBACK, ); - // Localize date formats. - if (\Drupal::moduleHandler()->moduleExists('language')) { - $items['admin/config/regional/date-time/locale'] = array( - 'title' => 'Localize', - 'description' => 'Configure date formats for each locale', - 'weight' => -8, - 'route_name' => 'system.date_format_language_overview', - ); - $items['admin/config/regional/date-time/locale/%/edit'] = array( - 'title' => 'Localize date formats', - 'route_name' => 'system.localize_date_format', - 'description' => 'Configure date formats for each locale', - ); - $items['admin/config/regional/date-time/locale/%/reset'] = array( - 'title' => 'Reset date formats', - 'description' => 'Reset localized date formats to global defaults', - 'route_name' => 'system.date_format_localize_reset', - ); - } - return $items; } diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index 4281cb4e4d64be0eb9fe8b4b2cfddb4c925b836c..77a741943c8e54583a8663956d4c5aa7902e021b 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -214,13 +214,6 @@ system.date_format_edit: requirements: _entity_access: 'date_format.update' -system.date_format_language_overview: - path: '/admin/config/regional/date-time/locale' - defaults: - _controller: '\Drupal\system\Controller\DateFormatLanguageController::overviewPage' - requirements: - _permission: 'administer site configuration' - system.date_format_delete: path: '/admin/config/regional/date-time/formats/manage/{date_format}/delete' defaults: @@ -229,13 +222,6 @@ system.date_format_delete: requirements: _entity_access: 'date_format.delete' -system.date_format_localize_reset: - path: '/admin/config/regional/date-time/locale/{langcode}/reset' - defaults: - _form: '\Drupal\system\Form\DateFormatLocalizeResetForm' - requirements: - _permission: 'administer site configuration' - system.modules_list: path: '/admin/modules' defaults: @@ -377,13 +363,5 @@ system.batch_page: requirements: _access: 'TRUE' -system.localize_date_format: - path: '/admin/config/regional/date-time/locale/{langcode}/edit' - defaults: - _content: '\Drupal\system\Form\SystemForm::localizeDateFormat' - _title: 'Localize date formats' - requirements: - _permission: 'administer site configuration' - system.update: path: '/core/update.php'