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
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 @coversDefaultClass \Drupal\Core\Cache\CacheCollector @group Cache
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. 22 7
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. 39
CacheContextsManagerTest class Drupal\Tests\Core\Cache\Context core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php @coversDefaultClass \Drupal\Core\Cache\Context\CacheContextsManager @group Cache
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\ProxyClass\Plugin core/lib/Drupal/Core/ProxyClass/Plugin/CachedDiscoveryClearer.php Provides a proxy class for \Drupal\Core\Plugin\CachedDiscoveryClearer.
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.
CachedDiscoveryClearerInterface interface Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/CachedDiscoveryClearerInterface.php Provides a way to clear static caches of all plugin managers. 2
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 6
CacheDecoratorInterface

in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement.

interface Drupal\Core\CacheDecorator core/lib/Drupal/Core/CacheDecorator/CacheDecoratorInterface.php Defines an interface for cache decorator implementations.
CachedStorage class Drupal\Core\Config core/lib/Drupal/Core/Config/CachedStorage.php Defines the cached storage. 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.
CacheFactory class Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheFactory.php 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 @coversDefaultClass \Drupal\Core\Cache\CacheFactory @group Cache
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 10
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.
CacheTagPreloadSubscriber class Drupal\Core\Cache\EventSubscriber core/lib/Drupal/Core/Cache/EventSubscriber/CacheTagPreloadSubscriber.php Preloads frequently used cache tags.
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
CacheTagsInvalidatorInterface interface Drupal\Core\Cache core/lib/Drupal/Core/Cache/CacheTagsInvalidatorInterface.php Defines required methods for classes wanting to handle cache tag changes. 10 20
CacheTagsInvalidatorTest class Drupal\Tests\Core\Cache core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php @coversDefaultClass \Drupal\Core\Cache\CacheTagsInvalidator @group Cache
CacheTagTest class Drupal\Tests\views\Functional\Plugin core/modules/views/tests/src/Functional/Plugin/CacheTagTest.php Tests tag cache plugin.
CacheTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/CacheTest.php Tests pluggable caching for views.
CacheTest class Drupal\Tests\Core\Cache core/tests/Drupal/Tests/Core/Cache/CacheTest.php @coversDefaultClass \Drupal\Core\Cache\Cache @group Cache
CacheTestBase abstract class Drupal\Tests\system\Functional\Cache core/modules/system/tests/src/Functional/Cache/CacheTestBase.php Provides helper methods for cache tests. 1
CacheTestController class Drupal\cache_test\Controller core/modules/system/tests/modules/cache_test/src/Controller/CacheTestController.php Controller routines for cache_test routes.
CacheWebTest class Drupal\Tests\views\Functional\Plugin core/modules/views/tests/src/Functional/Plugin/CacheWebTest.php Tests pluggable caching for views via a web test.
CalculatedCacheContextInterface interface Drupal\Core\Cache\Context core/lib/Drupal/Core/Cache/Context/CalculatedCacheContextInterface.php Provides an interface for defining a calculated cache context service. 10 3
CalculatedPermissions class Drupal\Core\Session core/lib/Drupal/Core/Session/CalculatedPermissions.php Represents a calculated set of permissions with cacheable metadata. 4
CalculatedPermissionsInterface interface Drupal\Core\Session core/lib/Drupal/Core/Session/CalculatedPermissionsInterface.php Defines the calculated permissions interface. 2 1
CalculatedPermissionsItem class Drupal\Core\Session core/lib/Drupal/Core/Session/CalculatedPermissionsItem.php Represents a single entry for the calculated permissions. 9
CalculatedPermissionsItemInterface interface Drupal\Core\Session core/lib/Drupal/Core/Session/CalculatedPermissionsItemInterface.php Defines the calculated permissions item interface. 1
CalculatedPermissionsItemTest class Drupal\Tests\Core\Session core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsItemTest.php Tests the CalculatedPermissionsItem value object.
CalculatedPermissionsTest class Drupal\Tests\Core\Session core/tests/Drupal/Tests/Core/Session/CalculatedPermissionsTest.php Tests the CalculatedPermissions value object.
CalculatedPermissionsTrait trait Drupal\Core\Session core/lib/Drupal/Core/Session/CalculatedPermissionsTrait.php Trait for \Drupal\Core\Session\CalculatedPermissionsInterface.
CallableClass class Drupal\Tests\Component\EventDispatcher core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php

Other projects


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