Classes, traits, and interfaces - main - drupal

Primary tabs

Introduction to classes

A lot of the PHP code in Drupal is object oriented (OO), making use of PHP classes, interfaces, and traits. See the Objected-oriented programming conventions for more information.

See also

Objected-oriented programming conventions

File

core/core.api.php, line 1529

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
Time class Drupal\Component\Datetime core/lib/Drupal/Component/Datetime/Time.php Provides a class for obtaining system time. 3 26 2
TimeInterface interface Drupal\Component\Datetime core/lib/Drupal/Component/Datetime/TimeInterface.php Defines an interface for obtaining system time. 1 117
TimeInterval class Drupal\views\Plugin\views\field core/modules/views/src/Plugin/views/field/TimeInterval.php A handler to provide proper displays for time intervals.
Timer class Drupal\Component\Utility core/lib/Drupal/Component/Utility/Timer.php Provides helpers to use timers throughout a request. 5
TimerTest class Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/TimerTest.php Tests the Timer system.
TimeSpan class Drupal\Core\TypedData\Plugin\DataType core/lib/Drupal/Core/TypedData/Plugin/DataType/TimeSpan.php The time span data type represents durations as number of seconds.
Timestamp class Drupal\Core\TypedData\Plugin\DataType core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php The timestamp data type. 4 1
TimestampAgoFormatter class Drupal\Core\Field\Plugin\Field\FieldFormatter core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampAgoFormatter.php Plugin implementation of the 'timestamp' formatter as time ago. 1 1
TimestampAgoFormatterTest class Drupal\FunctionalTests\Datetime core/tests/Drupal/FunctionalTests/Datetime/TimestampAgoFormatterTest.php Tests the functionality of TimestampAgoFormatter core field formatter.
TimestampDatetimeWidget class Drupal\Core\Datetime\Plugin\Field\FieldWidget core/lib/Drupal/Core/Datetime/Plugin/Field/FieldWidget/TimestampDatetimeWidget.php Plugin implementation of the 'datetime timestamp' widget.
TimestampFormatter class Drupal\Core\Field\Plugin\Field\FieldFormatter core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php Plugin implementation of the 'timestamp' formatter.
TimestampFormatterTest class Drupal\Tests\field\Kernel\Timestamp core/modules/field/tests/src/Kernel/Timestamp/TimestampFormatterTest.php Tests the timestamp formatters.
TimestampFormatterWithTimeDiffTest class Drupal\FunctionalJavascriptTests\Core\Field core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffTest.php Tests the 'timestamp' formatter when is used with time difference setting.
TimestampFormatterWithTimeDiffViewsTest class Drupal\FunctionalJavascriptTests\Core\Field core/tests/Drupal/FunctionalJavascriptTests/Core/Field/TimestampFormatterWithTimeDiffViewsTest.php Tests the timestamp formatter used with time difference setting in views.
TimestampItem class Drupal\Core\Field\Plugin\Field\FieldType core/lib/Drupal/Core/Field/Plugin/Field/FieldType/TimestampItem.php Defines the 'timestamp' entity field type. 1 3
TimestampItemNormalizer class Drupal\serialization\Normalizer core/modules/serialization/src/Normalizer/TimestampItemNormalizer.php Converts values for TimestampItem to and from common formats. 1 2
TimestampItemNormalizerTest class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/TimestampItemNormalizerTest.php Tests that TimestampItem (de)normalization uses Timestamp (de)normalization.
TimestampItemTest class Drupal\Tests\field\Kernel\Timestamp core/modules/field/tests/src/Kernel/Timestamp/TimestampItemTest.php Tests the timestamp fields.
TimestampNormalizer class Drupal\serialization\Normalizer core/modules/serialization/src/Normalizer/TimestampNormalizer.php Converts values for the Timestamp data type to and from common formats. 1 2
TimestampNormalizerTest class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php Unit test coverage for the "Timestamp" @DataType.
TimestampNormalizerTestDrupalDateTime class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/TimestampNormalizerTest.php Provides a test class for testing DrupalDateTime.
TimestampSchemaTest class Drupal\KernelTests\Core\Datetime core/tests/Drupal/KernelTests/Core/Datetime/TimestampSchemaTest.php Tests timestamp schema.
TimestampTest class Drupal\FunctionalTests\Datetime core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php Tests the functionality of Timestamp core field UI.
TimeTest class Drupal\Tests\Component\Datetime core/tests/Drupal/Tests/Component/Datetime/TimeTest.php Tests the Time class.
TimeWithNoRequestTest class Drupal\Tests\Component\Datetime core/tests/Drupal/Tests/Component/Datetime/TimeWithNoRequestTest.php Tests that getRequest(Micro)Time works when no underlying request exists.
TimeZone class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/TimeZone.php Process the Timezone offset into a Drupal compatible timezone name.
TimeZone class Drupal\system\Plugin\migrate\process\d6 core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php Process the D6 Timezone offset into a D8 compatible timezone name.
TimeZoneAbbreviationRouteTest class Drupal\Tests\system\Functional\Datetime core/modules/system/tests/src/Functional/Datetime/TimeZoneAbbreviationRouteTest.php Tests converting JavaScript time zone abbreviations to time zone identifiers.
TimeZoneAbbreviationRouteTest class Drupal\Tests\system\Kernel\Datetime core/modules/system/tests/src/Kernel/Datetime/TimeZoneAbbreviationRouteTest.php Tests converting JavaScript time zone abbreviations to time zone identifiers.
TimeZoneCacheContext class Drupal\Core\Cache\Context core/lib/Drupal/Core/Cache/Context/TimeZoneCacheContext.php Defines the TimeZoneCacheContext service, for "per time zone" caching. 2
TimezoneController class Drupal\system\Controller core/modules/system/src/Controller/TimezoneController.php Provides a callback for finding a time zone identifier.
TimeZoneFormHelper class Drupal\Core\Datetime core/lib/Drupal/Core/Datetime/TimeZoneFormHelper.php Helper class for dealing with timezones. 8
TimeZoneFormHelperTest class Drupal\Tests\Core\Datetime core/tests/Drupal/Tests/Core/Datetime/TimeZoneFormHelperTest.php Tests Drupal\Core\Datetime\TimeZoneFormHelper.
TimeZoneItem class Drupal\user core/modules/user/src/TimeZoneItem.php Defines a custom field item class for the 'timezone' user entity field. 1
TimeZoneResolver class Drupal\system core/modules/system/src/TimeZoneResolver.php Event handler that resolves time zone based on site and user configuration. 1 2
TimezoneResolverTest class Drupal\Tests\system\Kernel core/modules/system/tests/src/Kernel/TimezoneResolverTest.php Tests Drupal\system\TimeZoneResolver.
TimezoneTest class Drupal\KernelTests\Core\Datetime\Element core/tests/Drupal/KernelTests/Core/Datetime/Element/TimezoneTest.php Tests the timezone handling of datetime and datelist element types.
Title class Drupal\views\Plugin\views\area core/modules/views/src/Plugin/views/area/Title.php Views area title override handler.
TitleBlockPluginInterface interface Drupal\Core\Block core/lib/Drupal/Core/Block/TitleBlockPluginInterface.php The interface for "title" blocks. 2 5
TitleCallback class Drupal\Tests\Core\Controller core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php Provides an example title callback for the testDynamicTitle method above.
TitleClosureCallback class Drupal\Tests\Core\Controller core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php Provides an example title closure for the testTitleClosure method above.
TitleClosureTest class Drupal\KernelTests\Core\Routing core/tests/Drupal/KernelTests/Core/Routing/TitleClosureTest.php Tests title closures declared on Route attributes.
TitleResolver class Drupal\Core\Controller core/lib/Drupal/Core/Controller/TitleResolver.php Provides the default implementation of the title resolver interface. 1 2
TitleResolverInterface interface Drupal\Core\Controller core/lib/Drupal/Core/Controller/TitleResolverInterface.php Defines a class which knows how to generate the title from a given route. 1 9
TitleResolverTest class Drupal\Tests\Core\Controller core/tests/Drupal/Tests/Core/Controller/TitleResolverTest.php Tests Drupal\Core\Controller\TitleResolver.
Token class Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/Token.php Stores token data in a hidden form field. 1
Token class Drupal\Core\Utility core/lib/Drupal/Core/Utility/Token.php Drupal placeholder/token replacement system. 8 2
TokenHooks class Drupal\file\Hook core/modules/file/src/Hook/TokenHooks.php Hook implementations for file tokens.
TokenizeAreaPluginBase abstract class Drupal\views\Plugin\views\area core/modules/views/src/Plugin/views/area/TokenizeAreaPluginBase.php Tokenized base class for area handlers. 3
TokenizeAreaUITest class Drupal\Tests\views_ui\Functional core/modules/views_ui/tests/src/Functional/TokenizeAreaUITest.php Tests the token display for the TokenizeAreaPluginBase UI.

Other projects


Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.