Classes, traits, and interfaces - 10.3.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 1518

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
TermViewsData class Drupal\taxonomy core/modules/taxonomy/src/TermViewsData.php Provides the views data for the taxonomy entity type.
TermXmlAnonTest class Drupal\Tests\taxonomy\Functional\Rest core/modules/taxonomy/tests/src/Functional/Rest/TermXmlAnonTest.php @group rest @group #slow
TermXmlBasicAuthTest class Drupal\Tests\taxonomy\Functional\Rest core/modules/taxonomy/tests/src/Functional/Rest/TermXmlBasicAuthTest.php @group rest @group #slow
TermXmlCookieTest class Drupal\Tests\taxonomy\Functional\Rest core/modules/taxonomy/tests/src/Functional/Rest/TermXmlCookieTest.php @group rest @group #slow
Test class Drupal\media_test_source\Plugin\media\Source core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php Provides test media source. 4
Test class Drupal\test_page_test\Controller core/modules/system/tests/modules/test_page_test/src/Controller/Test.php Defines a test controller for page titles.
Test1Interface interface Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php Provides a test interface.
Test2Interface interface Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php Provides a different test interface.
TestAccessBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestAccessBlock.php Provides a block to test access.
TestAccessCheck class Drupal\router_test\Access core/modules/system/tests/modules/router_test_directory/src/Access/TestAccessCheck.php Access check for test routes.
TestAccessCheckInterface interface Drupal\Tests\Core\Access core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php Defines an interface with a defined access() method for mocking.
TestAccessClass class Drupal\Tests\Core\Render core/tests/Drupal/Tests/Core/Render/RendererTest.php
TestAction class Drupal\action_bulk_test\Plugin\Action core/modules/views/tests/modules/action_bulk_test/src/Plugin/Action/TestAction.php Test action.
TestActionConfirmForm class Drupal\action_bulk_test\Form core/modules/views/tests/modules/action_bulk_test/src/Form/TestActionConfirmForm.php Confirmation form for 'test_action' action. 1
TestAddForm class Drupal\media_library_form_overwrite_test\Form core/modules/media_library/tests/modules/media_library_form_overwrite_test/src/Form/TestAddForm.php Test add form. 2
TestAjaxBlock class Drupal\layout_builder_test\Plugin\Block core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/TestAjaxBlock.php Provides a 'TestAjax' block.
TestAnnotation class Drupal\Tests\Component\Annotation\Plugin\Discovery core/tests/Drupal/Tests/Component/Annotation/Plugin/Discovery/AnnotationBridgeDecoratorTest.php
TestAttribute class Drupal\Tests\Component\Plugin\Discovery core/tests/Drupal/Tests/Component/Plugin/Discovery/AttributeBridgeDecoratorTest.php
TestAttribute class Drupal\Tests\Core\Template core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php
TestAttributesBlock class Drupal\layout_builder_test\Plugin\Block core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/TestAttributesBlock.php Provides a 'TestAttributes' block.
TestAuth class Drupal\rest_test\Authentication\Provider core/modules/rest/tests/modules/rest_test/src/Authentication/Provider/TestAuth.php Authentication provider for testing purposes. 2
TestAuthenticationProvider class Drupal\Tests\Core\Authentication core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php A simple provider for unit testing AuthenticationCollector.
TestAuthenticationProviderInterface interface Drupal\Tests\Core\Authentication core/tests/Drupal/Tests/Core/Authentication/AuthenticationManagerTest.php Helper interface to mock two interfaces at once.
TestAuthGlobal class Drupal\rest_test\Authentication\Provider core/modules/rest/tests/modules/rest_test/src/Authentication/Provider/TestAuthGlobal.php Global authentication provider for testing purposes. 2
TestBaseFieldDefinitionInterface interface Drupal\Tests\Core\Field core/tests/Drupal/Tests/Core/Field/TestBaseFieldDefinitionInterface.php Defines a test interface to mock entity base field definitions.
TestBaseInterface interface Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php 1
TestBlockInstantiation class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php Provides a basic block for testing block instantiation and configuration. 1
TestBlockPluginWithRefinableDependentAccessInterface interface Drupal\Tests\layout_builder\Unit core/modules/layout_builder/tests/src/Unit/BlockComponentRenderArrayTest.php Test interface for dependent access block plugins.
TestCacheableDependency class Drupal\Tests\Core\Render core/tests/Drupal/Tests/Core/Render/TestCacheableDependency.php Cacheable dependency object for use in tests. 1
TestCacheBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php Provides a block to test caching. 1
TestCallables class Drupal\Tests\Core\Render core/tests/Drupal/Tests/Core/Render/RendererTest.php
TestChildInterface interface Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php 1
TestClass class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php
TestClass class Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php Provides a test class.
TestClass class Drupal\service_provider_test core/modules/system/tests/modules/service_provider_test/src/TestClass.php 2
TestClass class Drupal\Tests\layout_builder\Unit core/modules/layout_builder/tests/src/Unit/LayoutEntityHelperTraitTest.php Test class using the trait.
TestCompatibilityTrait trait Drupal\TestTools\PhpUnitCompatibility\PhpUnit9 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php Drupal's forward compatibility layer with multiple versions of PHPUnit.
TestConcat class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/ConcatTest.php
TestConditionAccessResolverTrait class Drupal\Tests\Core\Condition core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php
TestConfigEntityWithPluginCollections class Drupal\Tests\Core\Config\Entity core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
TestConfigFactoryOverrideBase class Drupal\Tests\Core\Config core/tests/Drupal/Tests/Core/Config/ConfigFactoryOverrideBaseTest.php
TestConfigNamesMapper class Drupal\Tests\config_translation\Unit core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php Defines a test mapper class.
TestConfigType class Drupal\module_installer_config_test\Entity core/modules/system/tests/modules/module_installer_config_test/src/Entity/TestConfigType.php Defines a configuration-based entity type used for testing.
TestConfigurableContextAwarePlugin class Drupal\KernelTests\Core\Plugin\Context core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php
TestConfigurableContextAwarePluginInterface interface Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
TestConfigurablePlugin class Drupal\Tests\Core\Plugin\Fixtures core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php 3
TestContainerDerivativeDiscovery class Drupal\Tests\Core\Plugin\Discovery core/tests/Drupal/Tests/Core/Plugin/Discovery/TestContainerDerivativeDiscovery.php Defines container test derivative discovery.
TestContent class Drupal\router_test core/modules/system/tests/modules/router_test_directory/src/TestContent.php Test controllers that are intended to be wrapped in a main controller.
TestContextAwareBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php Provides a context-aware block.
TestContextAwareLayout class Drupal\layout_builder_test\Plugin\Layout core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/TestContextAwareLayout.php The TestContextAwareLayout Class.

Other projects


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