Classes, traits, and interfaces - 9.5.x - 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 1523

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
Transaction class Drupal\Core\Database core/lib/Drupal/Core/Database/Transaction.php A wrapper class for creating and managing database transactions. 1 1
Transaction class Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/Transaction.php CorefakeWithAllCustomClasses implementation of \Drupal\Core\Database\Transaction.
TransactionCommitFailedException class Drupal\Core\Database core/lib/Drupal/Core/Database/TransactionCommitFailedException.php Exception thrown when a commit() function fails.
TransactionException class Drupal\Core\Database core/lib/Drupal/Core/Database/TransactionException.php Exception thrown by an error in a database transaction. 5
TransactionExplicitCommitNotAllowedException class Drupal\Core\Database core/lib/Drupal/Core/Database/TransactionExplicitCommitNotAllowedException.php Exception to deny attempts to explicitly manage transactions.
TransactionNameNonUniqueException class Drupal\Core\Database core/lib/Drupal/Core/Database/TransactionNameNonUniqueException.php Exception thrown when a savepoint or transaction name occurs twice.
TransactionNoActiveException class Drupal\Core\Database core/lib/Drupal/Core/Database/TransactionNoActiveException.php Exception for when popTransaction() is called with no active transaction. 2
TransactionOutOfOrderException class Drupal\Core\Database core/lib/Drupal/Core/Database/TransactionOutOfOrderException.php Exception thrown when a rollBack() resulted in other active transactions being rolled-back. 1
TransactionTest class Drupal\KernelTests\Core\Database core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php Tests the transaction abstraction system.
TransformedConfigExportImportUITest class Drupal\Tests\config\Functional core/modules/config/tests/src/Functional/TransformedConfigExportImportUITest.php Tests the user interface for importing/exporting transformed configuration.
Transition class Drupal\workflows core/modules/workflows/src/Transition.php A transition value object that describes the transition between states. 5
TransitionInterface interface Drupal\workflows core/modules/workflows/src/TransitionInterface.php A transition value object that describes the transition between two states. 1 3
TransitionTest class Drupal\Tests\workflows\Unit core/modules/workflows/tests/src/Unit/TransitionTest.php @coversDefaultClass \Drupal\workflows\Transition[[api-linebreak]]
TranslatableFieldTest class Drupal\Tests\layout_builder\Kernel core/modules/layout_builder/tests/src/Kernel/TranslatableFieldTest.php Tests Layout Builder with a translatable layout field.
TranslatableInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/TranslatableInterface.php Interface for translatable data. 1 11
TranslatableInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/TranslatableInterface.php Provides methods for an entity to support translation. 1 5
TranslatableMarkup class Drupal\Core\StringTranslation core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php Provides translatable markup class. 2 126
TranslatableMarkupTest class Drupal\Tests\Core\StringTranslation core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php Tests the TranslatableMarkup class.
TranslatableRevisionableInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/TranslatableRevisionableInterface.php Provides methods for an entity to support revision translation. 1
TranslatableRevisionableStorageInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/TranslatableRevisionableStorageInterface.php A storage that supports translatable and revisionable entity types. 1
TranslatableStorageInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/TranslatableStorageInterface.php A storage that supports translatable entity types. 1
TranslatedViewTest class Drupal\Tests\views_ui\Functional core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php Tests that translated strings in views UI don't override original strings.
TranslateEditForm class Drupal\locale\Form core/modules/locale/src/Form/TranslateEditForm.php Defines a translation edit form.
TranslateFilterForm class Drupal\locale\Form core/modules/locale/src/Form/TranslateFilterForm.php Provides a filtered translation edit form.
TranslateFormBase abstract class Drupal\locale\Form core/modules/locale/src/Form/TranslateFormBase.php Defines the locale user interface translation form base. 2
Translation class Drupal\Core\Annotation core/lib/Drupal/Core/Annotation/Translation.php Defines a translatable annotation object. 1
TranslationInterface interface Drupal\Core\StringTranslation core/lib/Drupal/Core/StringTranslation/TranslationInterface.php Interface for the translation.manager translation service. 2 59
TranslationLanguageRenderer class Drupal\views\Entity\Render core/modules/views/src/Entity/Render/TranslationLanguageRenderer.php Renders entity translations in their row language.
TranslationLink class Drupal\content_translation\Plugin\views\field core/modules/content_translation/src/Plugin/views/field/TranslationLink.php Provides a translation link for an entity.
TranslationLinkTest class Drupal\Tests\content_translation\Functional\Views core/modules/content_translation/tests/src/Functional/Views/TranslationLinkTest.php Tests the content translation overview link field handler.
TranslationManager class Drupal\Core\StringTranslation core/lib/Drupal/Core/StringTranslation/TranslationManager.php Defines a chained translation implementation combining multiple translators. 1 5 2
TranslationManagerTest class Drupal\Tests\Core\StringTranslation core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php @coversDefaultClass \Drupal\Core\StringTranslation\TranslationManager[[api-linebreak]] @group StringTranslation
TranslationsStream class Drupal\locale\StreamWrapper core/modules/locale/src/StreamWrapper/TranslationsStream.php Defines a Drupal translations (translations://) stream wrapper class. 2
TranslationStatusForm class Drupal\locale\Form core/modules/locale/src/Form/TranslationStatusForm.php Provides a translation status form. 1
TranslationStatusInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/TranslationStatusInterface.php Defines an interface for checking the status of an entity translation. 1 3
TranslationsTest class Drupal\Tests\media_library\FunctionalJavascript core/modules/media_library/tests/src/FunctionalJavascript/TranslationsTest.php Tests media library for translatable media.
TranslationString class Drupal\locale core/modules/locale/src/TranslationString.php Defines the locale translation string object. 1
TranslationStringTest class Drupal\KernelTests\Core\StringTranslation core/tests/Drupal/KernelTests/Core/StringTranslation/TranslationStringTest.php Tests the TranslatableMarkup class.
TranslationTest class Drupal\Tests\Core\Annotation core/tests/Drupal/Tests/Core/Annotation/TranslationTest.php @coversDefaultClass \Drupal\Core\Annotation\Translation[[api-linebreak]] @group Annotation
TranslationTest class Drupal\Tests\field\Kernel core/modules/field/tests/src/Kernel/TranslationTest.php Tests multilanguage fields logic.
TranslationWebTest class Drupal\Tests\field\Functional core/modules/field/tests/src/Functional/TranslationWebTest.php Tests multilanguage fields logic that require a full environment.
TranslationWrapper

in drupal:8.0.0 and is removed from drupal:11.0.0. Use the \Drupal\Core\StringTranslation\TranslatableMarkup class instead.

class Drupal\Core\StringTranslation core/lib/Drupal/Core/StringTranslation/TranslationWrapper.php Provides translatable string class. 1
TranslationWrapperTest class Drupal\Tests\Core\StringTranslation core/tests/Drupal/Tests/Core/StringTranslation/TranslationWrapperTest.php Tests the TranslationWrapper class.
TranslatorInterface interface Drupal\Core\StringTranslation\Translator core/lib/Drupal/Core/StringTranslation/Translator/TranslatorInterface.php Interface for objects capable of string translation. 3 3
TranslatorInterface interface Drupal\Core\Validation core/lib/Drupal/Core/Validation/TranslatorInterface.php Defines an interface used in validation. 1 3
TransliterationInterface interface Drupal\Component\Transliteration core/lib/Drupal/Component/Transliteration/TransliterationInterface.php Defines an interface for classes providing transliteration. 1 4
TraversableObject class Drupal\jsonapi_test_data_type core/modules/jsonapi/tests/modules/jsonapi_test_data_type/src/TraversableObject.php An object which implements \IteratorAggregate. 2
TraversableObjectNormalizer class Drupal\jsonapi_test_data_type\Normalizer core/modules/jsonapi/tests/modules/jsonapi_test_data_type/src/Normalizer/TraversableObjectNormalizer.php Normalizes TraversableObject. 2
TraversableTypedDataInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/TraversableTypedDataInterface.php An interface for typed data objects that can be traversed. 3 5
TRexEditor class Drupal\editor_test\Plugin\Editor core/modules/editor/tests/modules/editor_test/src/Plugin/Editor/TRexEditor.php Defines a Tyrannosaurus-Rex powered text editor for testing purposes.

Other projects


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