Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
311
Merge Requests
311
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
c435b714
Commit
c435b714
authored
Nov 11, 2013
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2127941
by Gábor Hojtsy: Remove two (out of 3) bogus and duplicate date languages UIs.
parent
4009f8f7
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
7 additions
and
673 deletions
+7
-673
core/modules/language/language.local_tasks.yml
core/modules/language/language.local_tasks.yml
+0
-6
core/modules/language/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php
...e/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php
+0
-10
core/modules/system/config/schema/system.schema.yml
core/modules/system/config/schema/system.schema.yml
+0
-6
core/modules/system/config/system.date_format.fallback.yml
core/modules/system/config/system.date_format.fallback.yml
+0
-1
core/modules/system/config/system.date_format.html_date.yml
core/modules/system/config/system.date_format.html_date.yml
+0
-1
core/modules/system/config/system.date_format.html_datetime.yml
...odules/system/config/system.date_format.html_datetime.yml
+0
-1
core/modules/system/config/system.date_format.html_month.yml
core/modules/system/config/system.date_format.html_month.yml
+0
-1
core/modules/system/config/system.date_format.html_time.yml
core/modules/system/config/system.date_format.html_time.yml
+0
-1
core/modules/system/config/system.date_format.html_week.yml
core/modules/system/config/system.date_format.html_week.yml
+0
-1
core/modules/system/config/system.date_format.html_year.yml
core/modules/system/config/system.date_format.html_year.yml
+0
-1
core/modules/system/config/system.date_format.html_yearless_date.yml
...s/system/config/system.date_format.html_yearless_date.yml
+0
-1
core/modules/system/config/system.date_format.long.yml
core/modules/system/config/system.date_format.long.yml
+0
-1
core/modules/system/config/system.date_format.medium.yml
core/modules/system/config/system.date_format.medium.yml
+0
-1
core/modules/system/config/system.date_format.short.yml
core/modules/system/config/system.date_format.short.yml
+0
-1
core/modules/system/lib/Drupal/system/Controller/DateFormatLanguageController.php
...Drupal/system/Controller/DateFormatLanguageController.php
+0
-51
core/modules/system/lib/Drupal/system/DateFormatInterface.php
.../modules/system/lib/Drupal/system/DateFormatInterface.php
+0
-38
core/modules/system/lib/Drupal/system/Entity/DateFormat.php
core/modules/system/lib/Drupal/system/Entity/DateFormat.php
+0
-76
core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php
...ules/system/lib/Drupal/system/Form/DateFormatFormBase.php
+7
-16
core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php
...em/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php
+0
-117
core/modules/system/lib/Drupal/system/Form/SystemForm.php
core/modules/system/lib/Drupal/system/Form/SystemForm.php
+0
-24
core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLanguageTest.php
...ib/Drupal/system/Tests/System/DateFormatsLanguageTest.php
+0
-114
core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php
...es/system/lib/Drupal/system/Tests/System/DateTimeTest.php
+0
-22
core/modules/system/system.admin.inc
core/modules/system/system.admin.inc
+0
-137
core/modules/system/system.module
core/modules/system/system.module
+0
-23
core/modules/system/system.routing.yml
core/modules/system/system.routing.yml
+0
-22
No files found.
core/modules/language/language.local_tasks.yml
View file @
c435b714
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
...
...
core/modules/language/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php
View file @
c435b714
...
...
@@ -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'
),
));
}
}
core/modules/system/config/schema/system.schema.yml
View file @
c435b714
...
...
@@ -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'
...
...
core/modules/system/config/system.date_format.fallback.yml
View file @
c435b714
...
...
@@ -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'
core/modules/system/config/system.date_format.html_date.yml
View file @
c435b714
...
...
@@ -4,7 +4,6 @@ label: 'HTML Date'
status
:
true
langcode
:
en
locked
:
true
locales
:
{
}
pattern
:
php
:
Y-m-d
intl
:
yyyy-MM-dd
core/modules/system/config/system.date_format.html_datetime.yml
View file @
c435b714
...
...
@@ -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'
core/modules/system/config/system.date_format.html_month.yml
View file @
c435b714
...
...
@@ -4,7 +4,6 @@ label: 'HTML Month'
status
:
true
langcode
:
en
locked
:
true
locales
:
{
}
pattern
:
php
:
Y-m
intl
:
Y-MM
core/modules/system/config/system.date_format.html_time.yml
View file @
c435b714
...
...
@@ -4,7 +4,6 @@ label: 'HTML Time'
status
:
true
langcode
:
en
locked
:
true
locales
:
{
}
pattern
:
php
:
'
H:i:s'
intl
:
'
H:mm:ss'
core/modules/system/config/system.date_format.html_week.yml
View file @
c435b714
...
...
@@ -4,7 +4,6 @@ label: 'HTML Week'
status
:
true
langcode
:
en
locked
:
true
locales
:
{
}
pattern
:
php
:
Y-\WW
intl
:
'
Y-'
'
W'
'
WW'
core/modules/system/config/system.date_format.html_year.yml
View file @
c435b714
...
...
@@ -4,7 +4,6 @@ label: 'HTML Year'
status
:
true
langcode
:
en
locked
:
true
locales
:
{
}
pattern
:
php
:
Y
intl
:
Y
core/modules/system/config/system.date_format.html_yearless_date.yml
View file @
c435b714
...
...
@@ -4,7 +4,6 @@ label: 'HTML Yearless date'
status
:
true
langcode
:
en
locked
:
true
locales
:
{
}
pattern
:
php
:
m-d
intl
:
MM-d
core/modules/system/config/system.date_format.long.yml
View file @
c435b714
...
...
@@ -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'
core/modules/system/config/system.date_format.medium.yml
View file @
c435b714
...
...
@@ -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'
core/modules/system/config/system.date_format.short.yml
View file @
c435b714
...
...
@@ -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'
core/modules/system/lib/Drupal/system/Controller/DateFormatLanguageController.php
deleted
100644 → 0
View file @
4009f8f7
<?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
);
}
}
core/modules/system/lib/Drupal/system/DateFormatInterface.php
View file @
c435b714
...
...
@@ -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.
*
...
...
core/modules/system/lib/Drupal/system/Entity/DateFormat.php
View file @
c435b714
...
...
@@ -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
();
}
}
}
}
}
core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php
View file @
c435b714
...
...
@@ -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
);
}
...
...
core/modules/system/lib/Drupal/system/Form/DateFormatLocalizeResetForm.php
deleted
100644 → 0
View file @
4009f8f7
<?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'
;
}
}
core/modules/system/lib/Drupal/system/Form/SystemForm.php
deleted
100644 → 0
View file @
4009f8f7
<?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
);
}
}
core/modules/system/lib/Drupal/system/Tests/System/DateFormatsLanguageTest.php
deleted
100644 → 0
View file @
4009f8f7
<?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'
));