Classes, traits, and interfaces - main - 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
TestHookOrderExtraTypes class Drupal\aaa_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/aaa_hook_collector_test/src/Hook/TestHookOrderExtraTypes.php This class contains hook implementations.
TestHookOrderExtraTypes class Drupal\bbb_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/bbb_hook_collector_test/src/Hook/TestHookOrderExtraTypes.php This class contains hook implementations.
TestHookRemove class Drupal\hook_test_remove\Hook core/modules/system/tests/modules/hook_test_remove/src/Hook/TestHookRemove.php Add a hook here, then remove it with another attribute.
TestHookReorderHookFirst class Drupal\aaa_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/aaa_hook_collector_test/src/Hook/TestHookReorderHookFirst.php This class contains hook implementations.
TestHookReorderHookLast class Drupal\bbb_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/bbb_hook_collector_test/src/Hook/TestHookReorderHookLast.php This class contains hook implementations. 1
TestHtmlBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestHtmlBlock.php Provides a block to test HTML. 1
TestHtmlMailCollector class Drupal\mail_html_test\Plugin\Mail core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php Defines a mail backend that captures sent HTML messages in the state system.
TestHtmxHooks class Drupal\test_htmx\Hook core/modules/system/tests/modules/test_htmx/src/Hook/TestHtmxHooks.php Hooks for the test_htmx module.
TestHttpClientMiddleware class Drupal\Core\Test\HttpClientMiddleware core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php Overrides the User-Agent HTTP header for outbound HTTP requests. 1
TestHttpMiddlewareClass class Drupal\Tests\Core\DependencyInjection\Fixture core/tests/Drupal/Tests/Core/DependencyInjection/Fixture/TestHttpMiddlewareClass.php Stub of http_middleware class. 1
TestingHooksProfile class Drupal\testing_hooks\Hook core/profiles/tests/testing_hooks/src/Hook/TestingHooksProfile.php Hook implementation on behalf of another module.
TestingProfileHooksTest class Drupal\FunctionalTests\Installer core/tests/Drupal/FunctionalTests/Installer/TestingProfileHooksTest.php Tests installing the Testing profile with update notifications on.
TestingProfileInstallTest class Drupal\FunctionalTests\Installer core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php Tests installing the Testing profile with update notifications on.
TestingRequirementsRequirements class Drupal\testing_requirements\Install\Requirements core/profiles/tests/testing_requirements/src/Install/Requirements/TestingRequirementsRequirements.php Install time requirements for the testing_requirements module.
TestingSiteConfigHooks class Drupal\testing_site_config\Hook core/profiles/tests/testing_site_config/src/Hook/TestingSiteConfigHooks.php Simulates a hook class with a dependency chain requiring the kernel.
TestInjection class Drupal\services_defaults_test core/modules/system/tests/modules/services_defaults_test/src/TestInjection.php A service that is injected via default autowiring. 2
TestInjection class Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestInjection.php A service that is autowired. 2 1
TestInjection2 class Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestInjection2.php A service that is autowired. 1
TestInjection2 class Drupal\services_defaults_test core/modules/system/tests/modules/services_defaults_test/src/TestInjection2.php A service that is injected via default autowiring.
TestInjection3 class Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestInjection3.php A service that is autowired. 1
TestInjectionInterface interface Drupal\services_defaults_test core/modules/system/tests/modules/services_defaults_test/src/TestInjectionInterface.php An interface for a service that is injected via default autowiring. 1
TestInjectionInterface interface Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestInjectionInterface.php An interface for a service that is autowired. 2
TestInlineTemplateFormBlock class Drupal\layout_builder_form_block_test\Plugin\Block core/modules/layout_builder/tests/modules/layout_builder_form_block_test/src/Plugin/Block/TestInlineTemplateFormBlock.php Provides a block containing inline template with <form> tag.
TestInstallerThemeHooks class Drupal\test_installer_theme\Hook core/modules/system/tests/themes/test_installer_theme/src/Hook/TestInstallerThemeHooks.php Form alter hooks for installer tests.
TestInstallStorage class Drupal\config_test core/modules/config/tests/config_test/src/TestInstallStorage.php Tests configuration of profiles, modules and themes. 1
TestInterface interface Drupal\Tests\Core\DependencyInjection core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php A test interface for testing ContainerBuilder::__construct().
TestInterface interface Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test interface. 1
TestInvalidController class Drupal\router_test\Controller core/modules/system/tests/modules/router_test_directory/src/Controller/TestInvalidController.php A structurally invalid controller that cannot be autoloaded.
TestInvalidHookCollectionHooks class Drupal\oop_hook_theme_with_module\Hook core/modules/system/tests/themes/HookCollector/oop_hook_theme_with_module/src/Hook/TestInvalidHookCollectionHooks.php Contains hooks that will throw exceptions during collection.
TestInvalidHookCollectionHooks class Drupal\oop_hook_theme_with_remove\Hook core/modules/system/tests/themes/HookCollector/oop_hook_theme_with_remove/src/Hook/TestInvalidHookCollectionHooks.php Contains hooks that will throw exceptions during collection.
TestInvalidHookCollectionHooks class Drupal\oop_hook_theme_with_order\Hook core/modules/system/tests/themes/HookCollector/oop_hook_theme_with_order/src/Hook/TestInvalidHookCollectionHooks.php Contains hooks that will throw exceptions during collection.
TestInvalidHookCollectionHooks class Drupal\oop_hook_theme_with_reorder\Hook core/modules/system/tests/themes/HookCollector/oop_hook_theme_with_reorder/src/Hook/TestInvalidHookCollectionHooks.php Contains hooks that will throw exceptions during collection.
TestItem class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItem.php Defines the 'test_field' entity field item. 5
TestItemTest class Drupal\Tests\field\Kernel core/modules/field/tests/src/Kernel/TestItemTest.php Tests the new entity API for the test field type.
TestItemWithDependencies class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithDependencies.php Defines the 'test_field_with_dependencies' entity field item.
TestItemWithDependenciesTest class Drupal\Tests\field\Kernel core/modules/field/tests/src/Kernel/TestItemWithDependenciesTest.php Tests the new entity API for the test field with dependencies type.
TestItemWithMultipleDescriptions class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithMultipleDescriptions.php Defines the 'test_field_with_multiple_descriptions' entity field item.
TestItemWithPreconfiguredOptions class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithPreconfiguredOptions.php Defines the 'test_field_with_preconfigured_options' entity field item.
TestItemWithSingleDescription class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithSingleDescription.php Defines the 'test_field_with_single_description' entity field item.
TestKernel class Drupal\Core\Test core/lib/Drupal/Core/Test/TestKernel.php Kernel that is only used by mock front controllers. 6
TestLayoutEntityHelperTrait class Drupal\Tests\layout_builder\Kernel core/modules/layout_builder/tests/src/Kernel/LayoutEntityHelperTraitTest.php Test class using the trait.
TestLazyPluginCollection class Drupal\plugin_test\Plugin core/modules/system/tests/modules/plugin_test/src/Plugin/TestLazyPluginCollection.php Defines a plugin collection which uses fruit plugins.
TestLibraryDiscoveryParser class Drupal\Tests\Core\Asset core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php Wraps the tested class to mock the external dependencies.
TestLoader class Drupal\twig_loader_test\Loader core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php A test Twig loader. 2
TestLocalAction class Drupal\menu_test\Plugin\Menu\LocalAction core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction.php Defines a test local action plugin class. 1
TestLocalAction4 class Drupal\menu_test\Plugin\Menu\LocalAction core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction4.php Defines a local action plugin with a dynamic title. 1
TestLocalAction5 class Drupal\menu_test\Plugin\Menu\LocalAction core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction5.php Defines a local action plugin with a dynamic title from user input. 1
TestLocalActionManager class Drupal\Tests\Core\Menu core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php Stub class for testing LocalActionManager.
TestLocalActionWithConfig class Drupal\menu_test\Plugin\Menu\LocalAction core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalActionWithConfig.php Defines a test local action plugin class. 1
TestLocalTaskController class Drupal\content_moderation_test_local_task\Controller core/modules/content_moderation/tests/modules/content_moderation_test_local_task/src/Controller/TestLocalTaskController.php A test controller.

Other projects


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