class TimeZoneItem
Same name and namespace in other branches
- 11.x core/modules/user/src/TimeZoneItem.php \Drupal\user\TimeZoneItem
- 10 core/modules/user/src/TimeZoneItem.php \Drupal\user\TimeZoneItem
- 9 core/modules/user/src/TimeZoneItem.php \Drupal\user\TimeZoneItem
- 8.9.x core/modules/user/src/TimeZoneItem.php \Drupal\user\TimeZoneItem
Defines a custom field item class for the 'timezone' user entity field.
Hierarchy
- class \Drupal\Core\TypedData\TypedData implements \Drupal\Core\TypedData\TypedDataInterface, \Drupal\Component\Plugin\PluginInspectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\TypedData\TypedDataTrait
- class \Drupal\Core\TypedData\Plugin\DataType\Map implements \Drupal\Core\TypedData\Plugin\DataType\IteratorAggregate, \Drupal\Core\TypedData\ComplexDataInterface extends \Drupal\Core\TypedData\TypedData
- class \Drupal\Core\Field\FieldItemBase implements \Drupal\Core\Field\FieldItemInterface extends \Drupal\Core\TypedData\Plugin\DataType\Map
- class \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase extends \Drupal\Core\Field\FieldItemBase
- class \Drupal\Core\Field\Plugin\Field\FieldType\StringItem extends \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase
- class \Drupal\user\TimeZoneItem extends \Drupal\Core\Field\Plugin\Field\FieldType\StringItem
- class \Drupal\Core\Field\Plugin\Field\FieldType\StringItem extends \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase
- class \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase extends \Drupal\Core\Field\FieldItemBase
- class \Drupal\Core\Field\FieldItemBase implements \Drupal\Core\Field\FieldItemInterface extends \Drupal\Core\TypedData\Plugin\DataType\Map
- class \Drupal\Core\TypedData\Plugin\DataType\Map implements \Drupal\Core\TypedData\Plugin\DataType\IteratorAggregate, \Drupal\Core\TypedData\ComplexDataInterface extends \Drupal\Core\TypedData\TypedData
Expanded class hierarchy of TimeZoneItem
File
-
core/
modules/ user/ src/ TimeZoneItem.php, line 12
Namespace
Drupal\userView source
class TimeZoneItem extends StringItem {
/**
* {@inheritdoc}
*/
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
$timezones = User::getAllowedTimezones();
// We need to vary the selected timezones since we're generating a sample.
$key = rand(0, count($timezones) - 1);
return $timezones[$key];
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
|---|---|---|---|---|
| DependencySerializationTrait::$_entityStorages | protected | property | An array of entity type IDs keyed by the property name of their storages. | |
| DependencySerializationTrait::$_serviceIds | protected | property | An array of service IDs keyed by property name used for serialization. | |
| DependencySerializationTrait::__sleep | public | function | ||
| DependencySerializationTrait::__wakeup | public | function | ||
| FieldItemBase::calculateDependencies | public static | function | ||
| FieldItemBase::calculateStorageDependencies | public static | function | ||
| FieldItemBase::defaultFieldSettings | public static | function | ||
| FieldItemBase::delete | public | function | ||
| FieldItemBase::deleteRevision | public | function | ||
| FieldItemBase::fieldSettingsForm | public | function | ||
| FieldItemBase::fieldSettingsFromConfigData | public static | function | ||
| FieldItemBase::fieldSettingsSummary | public static | function | ||
| FieldItemBase::fieldSettingsToConfigData | public static | function | ||
| FieldItemBase::getEntity | public | function | ||
| FieldItemBase::getFieldDefinition | public | function | ||
| FieldItemBase::getLangcode | public | function | ||
| FieldItemBase::getSetting | protected | function | Returns the value of a field setting. | |
| FieldItemBase::getSettings | protected | function | Returns the array of field settings. | |
| FieldItemBase::mainPropertyName | public static | function | ||
| FieldItemBase::onDependencyRemoval | public static | function | ||
| FieldItemBase::postSave | public | function | ||
| FieldItemBase::preSave | public | function | ||
| FieldItemBase::setValue | public | function | ||
| FieldItemBase::storageSettingsFromConfigData | public static | function | ||
| FieldItemBase::storageSettingsSummary | public static | function | ||
| FieldItemBase::storageSettingsToConfigData | public static | function | ||
| FieldItemBase::view | public | function | ||
| FieldItemBase::writePropertyValue | protected | function | Different to the parent Map class, we avoid creating property objects as far as possible in order to optimize performance. Thus we just update $this->values if no property object has been created yet. |
|
| FieldItemBase::__construct | public | function | ||
| FieldItemBase::__get | public | function | ||
| FieldItemBase::__isset | public | function | ||
| FieldItemBase::__set | public | function | ||
| FieldItemBase::__unset | public | function | ||
| Map::$definition | protected | property | The data definition. | |
| Map::$properties | protected | property | The array of properties. | |
| Map::$values | protected | property | An array of values for the contained properties. | |
| Map::applyDefaultValue | public | function | ||
| Map::get | public | function | ||
| Map::getIterator | public | function | Retrieves the iterator for the object. | |
| Map::getProperties | public | function | ||
| Map::getString | public | function | ||
| Map::getValue | public | function | ||
| Map::onChange | public | function | ||
| Map::set | public | function | ||
| Map::toArray | public | function | ||
| Map::__clone | public | function | Magic method: Implements a deep clone. | |
| StringItem::defaultStorageSettings | public static | function | ||
| StringItem::getConstraints | public | function | ||
| StringItem::schema | public static | function | ||
| StringItem::storageSettingsForm | public | function | ||
| StringItemBase::isEmpty | public | function | ||
| StringItemBase::propertyDefinitions | public static | function | ||
| StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | |
| StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | |
| StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | |
| StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | |
| StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | |
| StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | |
| TimeZoneItem::generateSampleValue | public static | function | Generates placeholder field values. | Overrides StringItem::generateSampleValue |
| TypedData::$name | protected | property | The property name. | |
| TypedData::$parent | protected | property | The parent typed data object. | |
| TypedData::createInstance | public static | function | ||
| TypedData::getDataDefinition | public | function | ||
| TypedData::getName | public | function | ||
| TypedData::getParent | public | function | ||
| TypedData::getPluginDefinition | public | function | ||
| TypedData::getPluginId | public | function | ||
| TypedData::getPropertyPath | public | function | ||
| TypedData::getRoot | public | function | ||
| TypedData::setContext | public | function | ||
| TypedData::validate | public | function | ||
| TypedDataTrait::$typedDataManager | protected | property | The typed data manager used for creating the data types. | |
| TypedDataTrait::getTypedDataManager | public | function | Gets the typed data manager. | |
| TypedDataTrait::setTypedDataManager | public | function | Sets the typed data manager. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.