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
TestExtension class Drupal\twig_extension_test\TwigExtension core/modules/system/tests/modules/twig_extension_test/src/TwigExtension/TestExtension.php A test Twig extension that adds a custom function and a custom filter. 1 2
TestExtension class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php Stub class for testing ExtensionList.
TestExternalDependencyInterface interface Drupal\plugin_test_extended\Plugin core/modules/system/tests/modules/plugin_test_extended/src/Plugin/TestExternalDependencyInterface.php This is an interface to be implemented by plugin classes in other modules. 1 1
TestExtractor class Drupal\icon_test\Plugin\IconExtractor core/modules/system/tests/modules/icon_test/src/Plugin/IconExtractor/TestExtractor.php Test plugin implementation of the icon_extractor. 1
TestExtractorWithFinder class Drupal\icon_test\Plugin\IconExtractor core/modules/system/tests/modules/icon_test/src/Plugin/IconExtractor/TestExtractorWithFinder.php Test plugin implementation of the icon_extractor. 1
TestFieldApplicableFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldApplicableFormatter.php Plugin implementation of the 'field_test_applicable' formatter.
TestFieldConstraint class Drupal\field_test\Plugin\Validation\Constraint core/modules/field/tests/modules/field_test/src/Plugin/Validation/Constraint/TestFieldConstraint.php Checks if a value is not equal.
TestFieldDefaultFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php Plugin implementation of the 'field_test_default' formatter.
TestFieldEmptyFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptyFormatter.php Plugin implementation of the 'field_empty_test' formatter.
TestFieldEmptySettingFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php Plugin implementation of the 'field_empty_setting' formatter.
TestFieldMultipleFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php Plugin implementation of the 'field_test_multiple' formatter.
TestFieldNoSettingsFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldNoSettingsFormatter.php Plugin implementation of the 'field_no_settings' formatter.
TestFieldPrepareViewFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php Plugin implementation of the 'field_test_with_prepare_view' formatter.
TestFieldType class Drupal\Tests\field\Unit core/modules/field/tests/src/Unit/FieldStorageConfigEntityUnitTest.php A test class to test field storage dependencies.
TestFieldWidget class Drupal\field_test\Plugin\Field\FieldWidget core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidget.php Plugin implementation of the 'test_field_widget' widget. 1
TestFieldWidgetMultilingual class Drupal\field_test\Plugin\Field\FieldWidget core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultilingual.php Plugin implementation of the 'test_field_widget_multilingual' widget.
TestFieldWidgetMultiple class Drupal\field_test\Plugin\Field\FieldWidget core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php Plugin implementation of the 'test_field_widget_multiple' widget. 1
TestFieldWidgetMultipleSingleValues class Drupal\field_test\Plugin\Field\FieldWidget core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultipleSingleValues.php Plugin implementation of the 'test_field_widget_multiple' widget.
TestFileCopy class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/FileCopyTest.php Class for testing FileCopy.
TestFileCreationTrait trait Drupal\Tests core/tests/Drupal/Tests/TestFileCreationTrait.php Provides methods to create test files from given values. 64
TestFileParser

in drupal:11.2.0 and is removed from drupal:12.0.0. There is no replacement.

class Drupal\Core\Test\RunTests core/lib/Drupal/Core/Test/RunTests/TestFileParser.php Parses class names from PHP files without loading them. 1
TestFileParserTest class Drupal\Tests\Core\Test\RunTests core/tests/Drupal/Tests/Core/Test/RunTests/TestFileParserTest.php Tests for the deprecated TestFileParser class.
TestFileUsage class Drupal\service_provider_test core/modules/system/tests/modules/service_provider_test/src/TestFileUsage.php Test class of database file usage backend implementation.
TestFilteredPluginManager class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php Class that allows testing the trait.
TestFilterIterator class Drupal\Tests\migrate\Kernel core/modules/migrate/tests/src/Kernel/TestFilterIterator.php Class to test FilterIterators.
TestForm class Drupal\dialog_renderer_test\Form core/modules/system/tests/modules/dialog_renderer_test/src/Form/TestForm.php Provides a form for testing the drupalAutoButtons dialog option. 1
TestForm class Drupal\test_page_test\Form core/modules/system/tests/modules/test_page_test/src/Form/TestForm.php Defines a test form for testing assertions. 1
TestForm class Drupal\block_test\Form core/modules/block/tests/modules/block_test/src/Form/TestForm.php Form that performs base block form test.
TestForm class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php Basic test form with interface implemented. 2
TestFormApiFormBlock class Drupal\layout_builder_form_block_test\Plugin\Block core/modules/layout_builder/tests/modules/layout_builder_form_block_test/src/Plugin/Block/TestFormApiFormBlock.php Provides a block containing a Form API form for use in Layout Builder tests.
TestFormBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestFormBlock.php Provides a block to test caching.
TestFormInjected class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php Basic test form with container injection interface implemented.
TestFormWithPredefinedForm class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php Basic test form with predefined form set.
TestHandler class Drupal\Tests\views\Unit\Plugin core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php Allow testing base handler implementation by extending the abstract class.
TestHelperPlugin class Drupal\views\Tests core/modules/views/src/Tests/TestHelperPlugin.php Wraps the plugin base class to be able to instantiate it. 1
TestHelpSection class Drupal\help_topics_test\Plugin\HelpSection core/modules/help/tests/modules/help_topics_test/src/Plugin/HelpSection/TestHelpSection.php Provides a searchable help section for testing.
TestHelpTopicDeriver class Drupal\help_topics_test\Plugin\Deriver core/modules/help/tests/modules/help_topics_test/src/Plugin/Deriver/TestHelpTopicDeriver.php A test discovery deriver for fake help topics. 1
TestHelpTopicPlugin class Drupal\help_topics_test\Plugin\HelpTopic core/modules/help/tests/modules/help_topics_test/src/Plugin/HelpTopic/TestHelpTopicPlugin.php A fake help topic plugin for testing. 1
TestHookAfter class Drupal\aaa_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/aaa_hook_collector_test/src/Hook/TestHookAfter.php This class contains hook implementations.
TestHookAfter class Drupal\bbb_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/bbb_hook_collector_test/src/Hook/TestHookAfter.php This class contains hook implementations.
TestHookAfterClassMethod class Drupal\aaa_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/aaa_hook_collector_test/src/Hook/TestHookAfterClassMethod.php This class contains hook implementations.
TestHookAfterClassMethod class Drupal\bbb_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/bbb_hook_collector_test/src/Hook/TestHookAfterClassMethod.php This class contains hook implementations. 1
TestHookBefore class Drupal\aaa_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/aaa_hook_collector_test/src/Hook/TestHookBefore.php This class contains hook implementations.
TestHookBefore class Drupal\bbb_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/bbb_hook_collector_test/src/Hook/TestHookBefore.php This class contains hook implementations.
TestHookClass class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php Class used to test ModuleHandler::hasImplementations()
TestHookCollectionHooks class Drupal\oop_hook_theme\Hook core/modules/system/tests/themes/HookCollector/oop_hook_theme/src/Hook/TestHookCollectionHooks.php Contains hooks for testing hook collection.
TestHookFirst class Drupal\aaa_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/aaa_hook_collector_test/src/Hook/TestHookFirst.php This class contains hook implementations.
TestHookFirst class Drupal\bbb_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/bbb_hook_collector_test/src/Hook/TestHookFirst.php This class contains hook implementations.
TestHookLast class Drupal\aaa_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/aaa_hook_collector_test/src/Hook/TestHookLast.php This class contains hook implementations.
TestHookLast class Drupal\bbb_hook_collector_test\Hook core/modules/system/tests/modules/HookCollector/bbb_hook_collector_test/src/Hook/TestHookLast.php This class contains hook implementations.

Other projects


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