3 namespace Drupal\Core\Datetime\Entity;
5 use Drupal\Core\Config\Entity\ConfigEntityBase;
6 use Drupal\Core\Config\Entity\ConfigEntityInterface;
7 use Drupal\Core\Datetime\DateFormatInterface;
10 * Defines the Date Format configuration entity class.
14 * label = @Translation("Date format"),
16 * "access" = "Drupal\system\DateFormatAccessControlHandler",
22 * admin_permission = "administer site configuration",
23 * list_cache_tags = { "rendered" },
32 class DateFormat extends ConfigEntityBase implements DateFormatInterface {
35 * The date format machine name.
42 * The human-readable name of the date format entity.
49 * The date format pattern.
56 * The locked status of this date format.
60 protected $locked = FALSE;
65 public function getPattern() {
66 return $this->pattern;
72 public function setPattern($pattern) {
73 $this->pattern = $pattern;
80 public function isLocked() {
81 return (bool) $this->locked;
87 public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
88 if ($a->isLocked() == $b->isLocked()) {
89 $a_label = $a->label();
90 $b_label = $b->label();
91 return strnatcasecmp($a_label, $b_label);
93 return $a->isLocked() ? 1 : -1;
99 public function getCacheTagsToInvalidate() {