class DateFormat
Same name in this branch
- main core/modules/config_translation/src/FormElement/DateFormat.php \Drupal\config_translation\FormElement\DateFormat
Same name and namespace in other branches
- 11.x core/modules/config_translation/src/FormElement/DateFormat.php \Drupal\config_translation\FormElement\DateFormat
- 11.x core/lib/Drupal/Core/Datetime/Entity/DateFormat.php \Drupal\Core\Datetime\Entity\DateFormat
- 10 core/modules/config_translation/src/FormElement/DateFormat.php \Drupal\config_translation\FormElement\DateFormat
- 10 core/lib/Drupal/Core/Datetime/Entity/DateFormat.php \Drupal\Core\Datetime\Entity\DateFormat
- 9 core/modules/config_translation/src/FormElement/DateFormat.php \Drupal\config_translation\FormElement\DateFormat
- 9 core/lib/Drupal/Core/Datetime/Entity/DateFormat.php \Drupal\Core\Datetime\Entity\DateFormat
- 8.9.x core/modules/config_translation/src/FormElement/DateFormat.php \Drupal\config_translation\FormElement\DateFormat
- 8.9.x core/lib/Drupal/Core/Datetime/Entity/DateFormat.php \Drupal\Core\Datetime\Entity\DateFormat
Defines the Date Format configuration entity class.
Attributes
#[ConfigEntityType(id: 'date_format', label: new TranslatableMarkup('Date format'), entity_keys: [
'id' => 'id',
'label' => 'label',
], handlers: [
'access' => DateFormatAccessControlHandler::class,
], admin_permission: 'administer site configuration', list_cache_tags: [
'rendered',
], config_export: [
'id',
'label',
'locked',
'pattern',
])]
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements \Drupal\Core\Entity\EntityInterface uses \Drupal\Core\Cache\RefinableCacheableDependencyTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Config\Entity\ConfigEntityBase implements \Drupal\Core\Config\Entity\ConfigEntityInterface uses \Drupal\Core\Plugin\PluginDependencyTrait, \Drupal\Core\Entity\SynchronizableEntityTrait extends \Drupal\Core\Entity\EntityBase
- class \Drupal\Core\Datetime\Entity\DateFormat implements \Drupal\Core\Datetime\DateFormatInterface extends \Drupal\Core\Config\Entity\ConfigEntityBase
- class \Drupal\Core\Config\Entity\ConfigEntityBase implements \Drupal\Core\Config\Entity\ConfigEntityInterface uses \Drupal\Core\Plugin\PluginDependencyTrait, \Drupal\Core\Entity\SynchronizableEntityTrait extends \Drupal\Core\Entity\EntityBase
Expanded class hierarchy of DateFormat
22 files declare their use of DateFormat
- CommentOrphanTest.php in core/
modules/ comment/ tests/ src/ Kernel/ CommentOrphanTest.php - CommentTokensHooks.php in core/
modules/ comment/ src/ Hook/ CommentTokensHooks.php - DateFormatAccessControlHandlerTest.php in core/
modules/ system/ tests/ src/ Kernel/ DateFormatAccessControlHandlerTest.php - DateFormatResourceTestBase.php in core/
tests/ Drupal/ FunctionalTests/ Rest/ DateFormatResourceTestBase.php - DateFormatTest.php in core/
modules/ jsonapi/ tests/ src/ Functional/ DateFormatTest.php
File
-
core/
lib/ Drupal/ Core/ Datetime/ Entity/ DateFormat.php, line 15
Namespace
Drupal\Core\Datetime\EntityView source
class DateFormat extends ConfigEntityBase implements DateFormatInterface {
/**
* The date format machine name.
*
* @var string
*/
protected $id;
/**
* The human-readable name of the date format entity.
*
* @var string
*/
protected $label;
/**
* The date format pattern.
*
* @var string
*/
protected $pattern;
/**
* The locked status of this date format.
*
* @var bool
*/
protected $locked = FALSE;
/**
* {@inheritdoc}
*/
public function getPattern() {
return $this->pattern;
}
/**
* {@inheritdoc}
*/
public function setPattern($pattern) {
$this->pattern = $pattern;
return $this;
}
/**
* {@inheritdoc}
*/
public function isLocked() {
return (bool) $this->locked;
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function getCacheTagsToInvalidate() {
return [
'rendered',
];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.