Commit 1d847657 authored by alexpott's avatar alexpott

Issue #2723577 by tylermenard, valthebald: Remove entity_load* usage for date_format entity type

parent 104134f9
......@@ -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
......
......@@ -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),
......
......@@ -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.
......
......@@ -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();
......
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