Classes, traits, and interfaces - 11.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 1529

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
BundlePermissionHandlerTraitTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/BundlePermissionHandlerTraitTest.php Tests Drupal\Core\Entity\BundlePermissionHandlerTrait.
BundleTranslationSettingsInterface interface Drupal\content_translation core/modules/content_translation/src/BundleTranslationSettingsInterface.php Interface providing support for content translation bundle settings. 1 2
Button class Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/Button.php Provides an action button form element. 1
Bytes class Drupal\Component\Utility core/lib/Drupal/Component/Utility/Bytes.php Provides helper methods for byte conversions. 12 1
ByteSizeMarkup final class Drupal\Core\StringTranslation core/lib/Drupal/Core/StringTranslation/ByteSizeMarkup.php A class to generate translatable markup for the given byte count. 17
ByteSizeMarkupTest class Drupal\Tests\Core\StringTranslation core/tests/Drupal/Tests/Core/StringTranslation/ByteSizeMarkupTest.php Tests Drupal\Core\StringTranslation\ByteSizeMarkup.
BytesTest class Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/BytesTest.php Tests bytes size parsing helper methods.
Cache class Drupal\Core\Cache core/lib/Drupal/Core/Cache/Cache.php Helper methods for cache. 221
CacheabilityMetadataConfigOverride class Drupal\config_override_integration_test core/modules/config/tests/config_override_integration_test/src/CacheabilityMetadataConfigOverride.php Test implementation of a config override that provides cacheability metadata. 2
CacheabilityMetadataConfigOverrideIntegrationTest class Drupal\Tests\config\Functional core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php Tests if configuration overrides correctly affect cacheability metadata.
CacheabilityMetadataConfigOverrideTest class Drupal\KernelTests\Core\Config core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php Tests if configuration overrides correctly affect cacheability metadata.
CacheableAccessDeniedHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableAccessDeniedHttpException.php A cacheable AccessDeniedHttpException. 1 5
CacheableAjaxResponse class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheableAjaxResponse.php A AjaxResponse that contains and can expose cacheability metadata. 1
CacheableBadRequestHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableBadRequestHttpException.php A cacheable BadRequestHttpException. 12
CacheableConflictHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableConflictHttpException.php A cacheable ConflictHttpException. 1
CacheableDependencyInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php Defines an interface for objects which may be used by other cached objects. 71 98
CacheableDependencyTrait trait Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheableDependencyTrait.php Trait for \Drupal\Core\Cache\CacheableDependencyInterface. 23
CacheableEmbeddedDataSource class Drupal\migrate_cache_counts_test\Plugin\migrate\source core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php A copy of embedded_data which allows caching the count.
CacheableExceptionTest class Drupal\Tests\Core\Http core/tests/Drupal/Tests/Core/Http/CacheableExceptionTest.php Tests Cacheable Exception.
CacheableGoneHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableGoneHttpException.php A cacheable GoneHttpException. 1
CacheableHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php A cacheable HttpException. 2
CacheableJsonResponse class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheableJsonResponse.php A JsonResponse that contains and can expose cacheability metadata. 6
CacheableLengthRequiredHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableLengthRequiredHttpException.php A cacheable LengthRequiredHttpException. 1
CacheableMetadata class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheableMetadata.php Defines a generic class for passing cacheability metadata. 2 202
CacheableMetadataCalculationTest class Drupal\Tests\views\Kernel core/modules/views/tests/src/Kernel/CacheableMetadataCalculationTest.php Tests that cacheability metadata is only calculated when needed.
CacheableMetadataCalculationTest class Drupal\views_test_cacheable_metadata_calculation\Plugin\views\access core/modules/views/tests/modules/views_test_cacheable_metadata_calculation/src/Plugin/views/access/CacheableMetadataCalculationTest.php Tests plugin that reports when cacheable metadata is being calculated.
CacheableMetadataTest class Drupal\Tests\Core\Cache core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php Tests Drupal\Core\Cache\CacheableMetadata.
CacheableMethodNotAllowedHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableMethodNotAllowedHttpException.php A cacheable MethodNotAllowedHttpException. 2
CacheableNormalization class Drupal\jsonapi\Normalizer\Value core/modules/jsonapi/src/Normalizer/Value/CacheableNormalization.php Use to store normalized data and its cacheability. 2 19
CacheableNormalizerInterface interface Drupal\serialization\Normalizer core/modules/serialization/src/Normalizer/CacheableNormalizerInterface.php Defines the interface for normalizers producing cacheable normalizations. 1 3
CacheableNotAcceptableHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableNotAcceptableHttpException.php A cacheable NotAcceptableHttpException. 1
CacheableNotFoundHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableNotFoundHttpException.php A cacheable NotFoundHttpException. 3
CacheableOmission final class Drupal\jsonapi\Normalizer\Value core/modules/jsonapi/src/Normalizer/Value/CacheableOmission.php Represents the cacheability associated with the omission of a value. 3
CacheablePreconditionFailedHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheablePreconditionFailedHttpException.php A cacheable PreconditionFailedHttpException. 1
CacheablePreconditionRequiredHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheablePreconditionRequiredHttpException.php A cacheable PreconditionRequiredHttpException. 1
CacheableRedirectResponse class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheableRedirectResponse.php A RedirectResponse that contains and can expose cacheability metadata. 3
CacheableResourceResponse class Drupal\jsonapi core/modules/jsonapi/src/CacheableResourceResponse.php Extends ResourceResponse with cacheability. 6
CacheableResponse class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheableResponse.php A response that contains and can expose cacheability metadata. 1 12
CacheableResponseInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheableResponseInterface.php Defines an interface for responses that can expose cacheability metadata. 9 25
CacheableResponseTrait trait Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheableResponseTrait.php Provides an implementation of CacheableResponseInterface. 6
CacheableRouteProviderInterface interface Drupal\Core\Routing core/lib/Drupal/Core/Routing/CacheableRouteProviderInterface.php Extends the router provider interface to provide caching support. 1 2
CacheableSecuredRedirectResponse abstract class Drupal\Core\Routing core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php Provides a common base class for cacheable safe redirects. 2
CacheableServiceUnavailableHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableServiceUnavailableHttpException.php A cacheable ServiceUnavailableHttpException. 1
CacheableTestDomainObject class Drupal\early_rendering_controller_test core/modules/system/tests/modules/early_rendering_controller_test/src/CacheableTestDomainObject.php Test domain class with implemented CacheableDependencyInterface.
CacheableTestResponse class Drupal\early_rendering_controller_test core/modules/system/tests/modules/early_rendering_controller_test/src/CacheableTestResponse.php Cacheable response used for testing.
CacheableTooManyRequestsHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableTooManyRequestsHttpException.php A cacheable TooManyRequestsHttpException. 1
CacheableUnauthorizedHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableUnauthorizedHttpException.php A cacheable UnauthorizedHttpException. 2
CacheableUnprocessableEntityHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableUnprocessableEntityHttpException.php A cacheable UnprocessableEntityHttpException. 1
CacheableUnsupportedMediaTypeHttpException class Drupal\Core\Http\Exception core/lib/Drupal/Core/Http/Exception/CacheableUnsupportedMediaTypeHttpException.php A cacheable UnsupportedMediaTypeHttpException. 1
CacheBackendDecorator class Drupal\performance_test\Cache core/modules/system/tests/modules/performance_test/src/Cache/CacheBackendDecorator.php Wraps an existing cache backend to track calls to the cache backend.

Other projects


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