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 1519

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
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.
CacheBackendInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheBackendInterface.php Defines an interface for cache implementations. 10 129 27
CacheCollector abstract class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheCollector.php Default implementation for CacheCollectorInterface. 9 10
CacheCollectorHelper class Drupal\Tests\Core\Cache core/tests/Drupal/Tests/Core/Cache/CacheCollectorHelper.php Helper class to test the cache collector. 1
CacheCollectorInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheCollectorInterface.php Provides a caching wrapper to be used in place of large structures. 3 2
CacheCollectorTest class Drupal\Tests\Core\Cache core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php Tests Drupal\Core\Cache\CacheCollector.
CacheCollectorTest class Drupal\KernelTests\Core\Cache core/tests/Drupal/KernelTests/Core/Cache/CacheCollectorTest.php Tests DatabaseBackend cache tag implementation.
CacheContextInterface interface Drupal\Core\Cache\Context core/lib/Drupal/Core/Cache/Context/CacheContextInterface.php Provides an interface for defining a cache context service. 21 6
CacheContextOptimizationTest class Drupal\KernelTests\Core\Cache core/tests/Drupal/KernelTests/Core/Cache/CacheContextOptimizationTest.php Tests the cache context optimization.
CacheContextsManager class Drupal\Core\Cache\Context core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php Converts cache context tokens into cache keys. 40 2
CacheContextsManagerTest class Drupal\Tests\Core\Cache\Context core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php Tests Drupal\Core\Cache\Context\CacheContextsManager.
CacheContextsPass class Drupal\Core\Cache\Context core/lib/Drupal/Core/Cache/Context/CacheContextsPass.php Adds cache_contexts parameter to the container. 1
CachedDataUITest class Drupal\Tests\views_ui\Functional core/modules/views_ui/tests/src/Functional/CachedDataUITest.php Tests the shared tempstore cache in the UI.
CachedDiscoveryClearer class Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/CachedDiscoveryClearer.php Defines a class which is capable of clearing the cache on plugin managers. 2
CachedDiscoveryClearerInterface interface Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/CachedDiscoveryClearerInterface.php Provides a way to clear static caches of all plugin managers. 1
CachedDiscoveryInterface interface Drupal\Component\Plugin\Discovery core/lib/Drupal/Component/Plugin/Discovery/CachedDiscoveryInterface.php Interface for discovery components holding a cache of plugin definitions. 4 7
CachedStorage class Drupal\Core\Config core/lib/Drupal/Core/Config/CachedStorage.php Defines the cached storage. 2 2
CachedStorageTest class Drupal\Tests\Core\Config core/tests/Drupal/Tests/Core/Config/CachedStorageTest.php Tests the interaction of cache and file storage in CachedStorage.
CachedStorageTest class Drupal\KernelTests\Core\Config\Storage core/tests/Drupal/KernelTests/Core/Config/Storage/CachedStorageTest.php Tests CachedStorage operations.
CachedStrategy class Drupal\Core\Render\Placeholder core/lib/Drupal/Core/Render/Placeholder/CachedStrategy.php Looks up placeholders in the render cache and returns those we could find. 2
CacheFactory class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheFactory.php Defines the cache backend factory. 2 2
CacheFactoryDecorator class Drupal\performance_test\Cache core/modules/system/tests/modules/performance_test/src/Cache/CacheFactoryDecorator.php Decorates a cache factory to register all calls to the cache system. 2
CacheFactoryInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheFactoryInterface.php An interface defining cache factory classes. 11 4
CacheFactoryTest class Drupal\Tests\Core\Cache core/tests/Drupal/Tests/Core/Cache/CacheFactoryTest.php Tests Drupal\Core\Cache\CacheFactory.
CacheItem class Drupal\Tests\Core\Session core/tests/Drupal/Tests/Core/Session/AccessPolicyProcessorTest.php Provides a simple cache.
CacheOptionalInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheOptionalInterface.php Indicates that caching is optional. 2 3
CachePluginBase abstract class Drupal\views\Plugin\views\cache core/modules/views/src/Plugin/views/cache/CachePluginBase.php The base plugin to handle caching. 3 8
CachePreWarmer class Drupal\Core\PreWarm core/lib/Drupal/Core/PreWarm/CachePreWarmer.php Prewarms caches for services that implement PreWarmableInterface. 1 2
CachePreWarmerInterface interface Drupal\Core\PreWarm core/lib/Drupal/Core/PreWarm/CachePreWarmerInterface.php Interface for cache prewarmers. 1
CachePreWarmerTest class Drupal\Tests\Core\PreWarm core/tests/Drupal/Tests/Core/PreWarm/CachePreWarmerTest.php Tests Drupal\Core\PreWarm\CachePreWarmer.
CacheRedirect class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheRedirect.php Defines a value object to represent a cache redirect. 3
CacheRouterRebuildSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/CacheRouterRebuildSubscriber.php Clear cache tags when the router is rebuilt. 2
CacheTagPreloadSubscriber class Drupal\Core\Cache\EventSubscriber core/lib/Drupal/Core/Cache/EventSubscriber/CacheTagPreloadSubscriber.php Preloads frequently used cache tags. 2
CacheTagsChecksumDecorator class Drupal\performance_test\Cache core/modules/system/tests/modules/performance_test/src/Cache/CacheTagsChecksumDecorator.php Wraps an existing cache tags checksum invalidator to track calls separately. 2
CacheTagsChecksumInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheTagsChecksumInterface.php Provides checksums for cache tag invalidations. 2 3
CacheTagsChecksumPreloadInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheTagsChecksumPreloadInterface.php Registers cache tags for preloading. 2 2
CacheTagsChecksumTrait trait Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php A trait for cache tag checksum implementations.
CacheTagsInvalidator class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheTagsInvalidator.php Passes cache tag events to classes that wish to respond to them. 1 2
CacheTagsInvalidatorInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheTagsInvalidatorInterface.php Defines required methods for classes wanting to handle cache tag changes. 10 21
CacheTagsInvalidatorTest class Drupal\Tests\Core\Cache core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php Tests Drupal\Core\Cache\CacheTagsInvalidator.

Other projects


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