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
CKEditor5StylesheetsTest class Drupal\Tests\ckeditor5\Kernel core/modules/ckeditor5/tests/src/Kernel/CKEditor5StylesheetsTest.php Test the ckeditor5-stylesheets theme config property.
CKEditor5Test class Drupal\Tests\ckeditor5\Unit core/modules/ckeditor5/tests/src/Unit/CKEditor5Test.php @coversDefaultClass \Drupal\ckeditor5\Plugin\Editor\CKEditor5 @group ckeditor5 @internal
CKEditor5Test class Drupal\Tests\ckeditor5\FunctionalJavascript core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php Tests for CKEditor 5.
CKEditor5TestBase abstract class Drupal\Tests\ckeditor5\FunctionalJavascript core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php Base class for testing CKEditor 5. 13
Ckeditor5TestModuleAllowedImageHooks class Drupal\ckeditor5_test_module_allowed_image\Hook core/modules/ckeditor5/tests/modules/ckeditor5_test_module_allowed_image/src/Hook/Ckeditor5TestModuleAllowedImageHooks.php Hook implementations for ckeditor5_test_module_allowed_image.
CKEditor5TestTrait trait Drupal\Tests\ckeditor5\Traits core/modules/ckeditor5/tests/src/Traits/CKEditor5TestTrait.php Provides methods to test CKEditor 5. 11
CKEditor5ToolbarTest class Drupal\Tests\ckeditor5\FunctionalJavascript core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5ToolbarTest.php Tests for CKEditor 5 editor UI with Toolbar module.
CKEditor5UpdateCodeBlockConfigurationTest class Drupal\Tests\ckeditor5\Functional\Update core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateCodeBlockConfigurationTest.php @covers ckeditor5_post_update_code_block @group Update @group ckeditor5
CKEditor5UpdateImageToolbarItemTest class Drupal\Tests\ckeditor5\Functional\Update core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateImageToolbarItemTest.php Tests the update path for the CKEditor 5 image toolbar item.
CKEditor5UpdateListMultiBlockTest class Drupal\Tests\ckeditor5\Functional\Update core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateListMultiBlockTest.php @covers ckeditor5_post_update_list_multiblock @group Update @group ckeditor5
CKEditor5UpdateOlStartReversed class Drupal\Tests\ckeditor5\Functional\Update core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateOlStartReversed.php @covers ckeditor5_post_update_list_start_reversed @group Update @group ckeditor5
CKEditor5UpdatePluginSettingsSortTest class Drupal\Tests\ckeditor5\Functional\Update core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdatePluginSettingsSortTest.php @covers ckeditor5_post_update_plugins_settings_export_order @group Update @group ckeditor5
CKEditor5ValidationTestTrait trait Drupal\Tests\ckeditor5\Kernel core/modules/ckeditor5/tests/src/Kernel/CKEditor5ValidationTestTrait.php Defines a trait for testing CKEditor 5 validity.
CKEditorStylesheetsWarningTest class Drupal\Tests\ckeditor5\FunctionalJavascript core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditorStylesheetsWarningTest.php Tests warnings when ckeditor_stylesheets do not have CKEditor 5 equivalents.
CkeditorTestHooks class Drupal\ckeditor_test\Hook core/modules/ckeditor5/tests/modules/ckeditor_test/src/Hook/CkeditorTestHooks.php Hook implementations for ckeditor_test.
ClaroBlockFilterTest class Drupal\FunctionalJavascriptTests\Theme core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroBlockFilterTest.php Runs BlockFilterTest in Claro.
ClaroEntityDisplayTest class Drupal\FunctionalJavascriptTests\Theme core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroEntityDisplayTest.php Runs EntityDisplayTest in Claro.
ClaroLayoutBuilderTest class Drupal\FunctionalTests\Theme core/tests/Drupal/FunctionalTests/Theme/ClaroLayoutBuilderTest.php Tests the layout builder with the Claro theme.
ClaroMenuUiJavascriptTest class Drupal\FunctionalJavascriptTests\Theme core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroMenuUiJavascriptTest.php Runs MenuUiJavascriptTest in Claro.
ClaroModalDisplayTest class Drupal\FunctionalJavascriptTests\Theme core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroModalDisplayTest.php Tests that buttons in modals are not in their button pane.
ClaroPasswordConfirmWidgetTest class Drupal\FunctionalJavascriptTests\Theme core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroPasswordConfirmWidgetTest.php Tests the password confirm widget with Claro theme.
ClaroPreRender class Drupal\claro core/themes/claro/src/ClaroPreRender.php Implements trusted prerender callbacks for the Claro theme. 3
ClaroTableDragTest class Drupal\FunctionalJavascriptTests\Theme core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroTableDragTest.php Tests draggable tables with Claro theme.
ClaroTableTest class Drupal\KernelTests\Core\Theme core/tests/Drupal/KernelTests/Core/Theme/ClaroTableTest.php Tests Claro specific table functionality.
ClaroTest class Drupal\FunctionalTests\Theme core/tests/Drupal/FunctionalTests/Theme/ClaroTest.php Tests the Claro theme.
ClaroVerticalTabsTest class Drupal\KernelTests\Core\Theme core/tests/Drupal/KernelTests/Core/Theme/ClaroVerticalTabsTest.php Confirms that Claro can render vertical tabs correctly.
ClaroViewsBulkOperationsTest class Drupal\FunctionalJavascriptTests\Theme core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsBulkOperationsTest.php Tests Claro's Views Bulk Operations form.
ClaroViewsUiTest class Drupal\FunctionalJavascriptTests\Theme core/tests/Drupal/FunctionalJavascriptTests/Theme/ClaroViewsUiTest.php Runs tests on Views UI using Claro.
ClassFinder class Drupal\Component\ClassFinder core/lib/Drupal/Component/ClassFinder/ClassFinder.php A Utility class that uses active autoloaders to find a file for a class. 3
ClassFinderInterface interface Drupal\Component\ClassFinder core/lib/Drupal/Component/ClassFinder/ClassFinderInterface.php Finds a class in a PSR-0 structure. 2 1
ClassFinderTest class Drupal\Tests\Component\ClassFinder core/tests/Drupal/Tests/Component/ClassFinder/ClassFinderTest.php @coversDefaultClass \Drupal\Component\ClassFinder\ClassFinder @group ClassFinder
ClassLoaderTest class Drupal\Tests\system\Functional\Module core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php Tests class loading for modules.
ClassResolver class Drupal\Core\DependencyInjection core/lib/Drupal/Core/DependencyInjection/ClassResolver.php Implements the class resolver interface supporting class names and services. 3
ClassResolverInterface interface Drupal\Core\DependencyInjection core/lib/Drupal/Core/DependencyInjection/ClassResolverInterface.php Provides interface to get an instance of a class with dependency injection. 1 21
ClassWithConstants class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/ClassWithConstants.php 1
ClassWithInvalidAnnotationTargetAtClass class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/ClassWithInvalidAnnotationTargetAtClass.php Plugin annotation @AnnotationTargetPropertyMethod("Some data");
ClassWithInvalidAnnotationTargetAtMethod class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/ClassWithInvalidAnnotationTargetAtMethod.php Plugin annotation @AnnotationTargetClass("Some data");
ClassWithInvalidAnnotationTargetAtProperty class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/ClassWithInvalidAnnotationTargetAtProperty.php Plugin annotation @AnnotationTargetClass("Some data");
ClassWithValidAnnotationTarget class Drupal\Tests\Component\Annotation\Doctrine\Fixtures core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/ClassWithValidAnnotationTarget.php Plugin annotation @AnnotationTargetClass("Some data");
ClassWriter final class Drupal\TestTools\PhpUnitCompatibility core/tests/Drupal/TestTools/PhpUnitCompatibility/ClassWriter.php Helper class to rewrite PHPUnit's TestCase class.
Cleaner final class Drupal\package_manager\Plugin\QueueWorker core/modules/package_manager/src/Plugin/QueueWorker/Cleaner.php Processes a queue of defunct stage directories, deleting them.
ClearCacheBlock class Drupal\system\Plugin\Block core/modules/system/src/Plugin/Block/ClearCacheBlock.php Provides a block to display 'Clear cache' elements.
ClearCacheBlockTest class Drupal\Tests\system\Functional\Block core/modules/system/tests/src/Functional/Block/ClearCacheBlockTest.php Tests clear cache block behavior.
ClearCacheForm class Drupal\system\Form core/modules/system/src/Form/ClearCacheForm.php Clear caches for this site. 2
ClearTest class Drupal\Tests\system\Functional\Cache core/modules/system/tests/src/Functional/Cache/ClearTest.php Tests our clearing is done the proper way.
ClickSortingAJAXTest class Drupal\Tests\views\FunctionalJavascript core/modules/views/tests/src/FunctionalJavascript/ClickSortingAJAXTest.php Tests the click sorting AJAX functionality of Views exposed forms.
ClientErrorResponseSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/ClientErrorResponseSubscriber.php Response subscriber to set the '4xx-response' cache tag on 4xx responses.
ClientFactory class Drupal\Core\Http core/lib/Drupal/Core/Http/ClientFactory.php Helper class to construct a HTTP client with Drupal specific config. 1
ClientFactoryTest class Drupal\Tests\Core\Http core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php @coversDefaultClass \Drupal\Core\Http\ClientFactory @group Http
CloseDialogCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/CloseDialogCommand.php Defines an AJAX command that closes the current active dialog. 1 6

Other projects


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