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
294
Merge Requests
294
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
1d847657
Commit
1d847657
authored
May 14, 2016
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2723577
by tylermenard, valthebald: Remove entity_load* usage for date_format entity type
parent
104134f9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
core/lib/Drupal/Core/Datetime/Element/Datetime.php
core/lib/Drupal/Core/Datetime/Element/Datetime.php
+2
-2
core/modules/datetime/src/Tests/DateTimeFieldTest.php
core/modules/datetime/src/Tests/DateTimeFieldTest.php
+5
-4
core/modules/system/src/Tests/System/DateTimeTest.php
core/modules/system/src/Tests/System/DateTimeTest.php
+2
-2
core/modules/user/src/Tests/UserTimeZoneTest.php
core/modules/user/src/Tests/UserTimeZoneTest.php
+2
-1
No files found.
core/lib/Drupal/Core/Datetime/Element/Datetime.php
View file @
1d847657
...
...
@@ -150,7 +150,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form
* list of the possible formats and HTML5 standards for the HTML5
* requirements. Defaults to the right HTML5 format for the chosen element
* if a HTML5 element is used, otherwise defaults to
*
entity_load('date_format',
'html_date')->getPattern().
*
DateFormat::load(
'html_date')->getPattern().
* - #date_date_element: The date element. Options are:
* - datetime: Use the HTML5 datetime element type.
* - datetime-local: Use the HTML5 datetime-local element type.
...
...
@@ -170,7 +170,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form
* a list of the possible formats and HTML5 standards for the HTML5
* requirements. Defaults to the right HTML5 format for the chosen element
* if a HTML5 element is used, otherwise defaults to
*
entity_load('date_format',
'html_time')->getPattern().
*
DateFormat::load(
'html_time')->getPattern().
* - #date_time_callbacks: An array of optional callbacks for the time
* element. Can be used to add a jQuery timepicker or an 'All day' checkbox.
* - #date_year_range: A description of the range of years to allow, like
...
...
core/modules/datetime/src/Tests/DateTimeFieldTest.php
View file @
1d847657
...
...
@@ -5,6 +5,7 @@
use
Drupal\Component\Utility\SafeMarkup
;
use
Drupal\Component\Utility\Unicode
;
use
Drupal\Core\Datetime\DrupalDateTime
;
use
Drupal\Core\Datetime\Entity\DateFormat
;
use
Drupal\Core\Entity\Entity\EntityViewDisplay
;
use
Drupal\field\Entity\FieldConfig
;
use
Drupal\field\Entity\FieldStorageConfig
;
...
...
@@ -132,8 +133,8 @@ function testDateField() {
$date
->
setTimezone
(
timezone_open
(
drupal_get_user_timezone
()));
// Submit a valid date and ensure it is accepted.
$date_format
=
entity_load
(
'date_format'
,
'html_date'
)
->
getPattern
();
$time_format
=
entity_load
(
'date_format'
,
'html_time'
)
->
getPattern
();
$date_format
=
DateFormat
::
load
(
'html_date'
)
->
getPattern
();
$time_format
=
DateFormat
::
load
(
'html_time'
)
->
getPattern
();
$edit
=
array
(
"
{
$field_name
}
[0][value][date]"
=>
$date
->
format
(
$date_format
),
...
...
@@ -261,8 +262,8 @@ function testDatetimeField() {
$date
->
setTimezone
(
timezone_open
(
drupal_get_user_timezone
()));
// Submit a valid date and ensure it is accepted.
$date_format
=
entity_load
(
'date_format'
,
'html_date'
)
->
getPattern
();
$time_format
=
entity_load
(
'date_format'
,
'html_time'
)
->
getPattern
();
$date_format
=
DateFormat
::
load
(
'html_date'
)
->
getPattern
();
$time_format
=
DateFormat
::
load
(
'html_time'
)
->
getPattern
();
$edit
=
array
(
"
{
$field_name
}
[0][value][date]"
=>
$date
->
format
(
$date_format
),
...
...
core/modules/system/src/Tests/System/DateTimeTest.php
View file @
1d847657
...
...
@@ -45,7 +45,7 @@ function testTimeZoneHandling() {
->
set
(
'timezone.default'
,
'Pacific/Honolulu'
)
->
set
(
'timezone.user.configurable'
,
0
)
->
save
();
entity_load
(
'date_format'
,
'medium'
)
DateFormat
::
load
(
'medium'
)
->
setPattern
(
'Y-m-d H:i:s O'
)
->
save
();
...
...
@@ -120,7 +120,7 @@ function testDateFormatConfiguration() {
$this
->
assertRaw
(
t
(
'The date format %format has been deleted.'
,
array
(
'%format'
=>
$name
)),
'Custom date format removed.'
);
// Make sure the date does not exist in config.
$date_format
=
entity_load
(
'date_format'
,
$date_format_id
);
$date_format
=
DateFormat
::
load
(
$date_format_id
);
$this
->
assertFalse
(
$date_format
);
// Add a new date format with an existing format.
...
...
core/modules/user/src/Tests/UserTimeZoneTest.php
View file @
1d847657
...
...
@@ -2,6 +2,7 @@
namespace
Drupal\user\Tests
;
use
Drupal\Core\Datetime\Entity\DateFormat
;
use
Drupal\simpletest\WebTestBase
;
/**
...
...
@@ -27,7 +28,7 @@ function testUserTimeZone() {
->
set
(
'timezone.user.configurable'
,
1
)
->
set
(
'timezone.default'
,
'America/Los_Angeles'
)
->
save
();
entity_load
(
'date_format'
,
'medium'
)
DateFormat
::
load
(
'medium'
)
->
setPattern
(
'Y-m-d H:i T'
)
->
save
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment