Same filename in this branch
- 10 core/modules/config_translation/src/FormElement/DateFormat.php
- 10 core/lib/Drupal/Core/Datetime/Entity/DateFormat.php
Same filename and directory in other branches
- 8.9.x core/lib/Drupal/Core/Datetime/Entity/DateFormat.php
- 9 core/lib/Drupal/Core/Datetime/Entity/DateFormat.php
Namespace
Drupal\Core\Datetime\Entity
File
core/lib/Drupal/Core/Datetime/Entity/DateFormat.php
View source
<?php
namespace Drupal\Core\Datetime\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Datetime\DateFormatInterface;
class DateFormat extends ConfigEntityBase implements DateFormatInterface {
protected $id;
protected $label;
protected $pattern;
protected $locked = FALSE;
public function getPattern() {
return $this->pattern;
}
public function setPattern($pattern) {
$this->pattern = $pattern;
return $this;
}
public function isLocked() {
return (bool) $this->locked;
}
public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
if ($a
->isLocked() == $b
->isLocked()) {
$a_label = $a
->label();
$b_label = $b
->label();
return strnatcasecmp($a_label, $b_label);
}
return $a
->isLocked() ? 1 : -1;
}
public function getCacheTagsToInvalidate() {
return [
'rendered',
];
}
}
Classes
Name |
Description |
DateFormat |
Defines the Date Format configuration entity class. |