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
AddComponentTest class Drupal\Tests\layout_builder\Kernel\Plugin\ConfigAction core/modules/layout_builder/tests/src/Kernel/Plugin/ConfigAction/AddComponentTest.php Tests that `addComponentToLayout` config action.
AddCssCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/AddCssCommand.php An AJAX command for adding css to the page via ajax.
AddedStylesheetsTest class Drupal\Tests\ckeditor5\Functional core/modules/ckeditor5/tests/src/Functional/AddedStylesheetsTest.php Test the ckeditor5-stylesheets theme config property.
AddFeedTest class Drupal\Tests\system\Kernel\Common core/modules/system/tests/src/Kernel/Common/AddFeedTest.php Make sure that attaching feeds works correctly with various constructs.
AddFormBase abstract class Drupal\media_library\Form core/modules/media_library/src/Form/AddFormBase.php Provides a base class for creating media items from within the media library.
AddHandler class Drupal\views_ui\Form\Ajax core/modules/views_ui/src/Form/Ajax/AddHandler.php Provides a form for adding an item in the Views UI.
AddItemToToolbar final class Drupal\ckeditor5\Plugin\ConfigAction core/modules/ckeditor5/src/Plugin/ConfigAction/AddItemToToolbar.php Config action plugin to add an item to the toolbar.
AddItemToToolbarConfigActionTest class Drupal\Tests\ckeditor5\Kernel\ConfigAction core/modules/ckeditor5/tests/src/Kernel/ConfigAction/AddItemToToolbarConfigActionTest.php Tests add item to toolbar config action.
AddJsCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/AddJsCommand.php An AJAX command for adding JS to the page via AJAX.
AddListPluginStylesTest class Drupal\Tests\ckeditor5\Functional\Update core/modules/ckeditor5/tests/src/Functional/Update/AddListPluginStylesTest.php Tests creating base field overrides for the promote field on node types.
AddModeration final class Drupal\content_moderation\Plugin\ConfigAction core/modules/content_moderation/src/Plugin/ConfigAction/AddModeration.php @internal This API is experimental.
AddModerationConfigActionTest class Drupal\Tests\content_moderation\Kernel\ConfigAction core/modules/content_moderation/tests/src/Kernel/ConfigAction/AddModerationConfigActionTest.php Tests Add Moderation Config Action.
AddModerationDeriver final class Drupal\content_moderation\Plugin\ConfigAction core/modules/content_moderation/src/Plugin/ConfigAction/AddModerationDeriver.php Deriver for moderation config actions plugins.
AddNavigationBlock final class Drupal\navigation\Plugin\ConfigAction core/modules/navigation/src/Plugin/ConfigAction/AddNavigationBlock.php @internal This API is experimental.
AddNavigationBlockConfigActionTest class Drupal\Tests\navigation\Kernel\ConfigAction core/modules/navigation/tests/src/Kernel/ConfigAction/AddNavigationBlockConfigActionTest.php Tests Add Navigation Block Config Action.
AddRoleUser class Drupal\user\Plugin\Action core/modules/user/src/Plugin/Action/AddRoleUser.php Adds a role to a user.
AddRoleUserTest class Drupal\Tests\user\Unit\Plugin\Action core/modules/user/tests/src/Unit/Plugin/Action/AddRoleUserTest.php Tests Drupal\user\Plugin\Action\AddRoleUser.
AddSectionController class Drupal\layout_builder\Controller core/modules/layout_builder/src/Controller/AddSectionController.php Defines a controller to add a new section.
AddToAllBundles final class Drupal\field\Plugin\ConfigAction core/modules/field/src/Plugin/ConfigAction/AddToAllBundles.php Adds a field to all bundles of its target entity type.
AddToAllBundlesConfigActionTest class Drupal\Tests\field\Kernel core/modules/field/tests/src/Kernel/AddToAllBundlesConfigActionTest.php Tests Add To All Bundles Config Action.
AdminAccountSwitcher final class Drupal\Core\DefaultContent core/lib/Drupal/Core/DefaultContent/AdminAccountSwitcher.php @internal This API is experimental.
AdminAccountSwitcherTest class Drupal\KernelTests\Core\DefaultContent core/tests/Drupal/KernelTests/Core/DefaultContent/AdminAccountSwitcherTest.php Tests Admin Account Switcher.
AdminAjaxTest class Drupal\Tests\views_ui\FunctionalJavascript core/modules/views_ui/tests/src/FunctionalJavascript/AdminAjaxTest.php Tests the admin UI AJAX interactions.
AdminContext class Drupal\Core\Routing core/lib/Drupal/Core/Routing/AdminContext.php Provides a helper class to determine whether the route is an admin one.
AdminController class Drupal\system\Controller core/modules/system/src/Controller/AdminController.php Controller for admin section.
AdminDemoNegotiator class Drupal\block\Theme core/modules/block/src/Theme/AdminDemoNegotiator.php Negotiates the theme for the block admin demo page via the URL.
AdminHtmlRouteProvider class Drupal\Core\Entity\Routing core/lib/Drupal/Core/Entity/Routing/AdminHtmlRouteProvider.php Provides HTML routes for entities with administrative add/edit/delete pages.
AdminMetaTagTest class Drupal\Tests\system\Functional\System core/modules/system/tests/src/Functional/System/AdminMetaTagTest.php Confirm that the fingerprinting meta tag appears as expected.
AdminNegotiator class Drupal\user\Theme core/modules/user/src/Theme/AdminNegotiator.php Sets the active theme on admin pages.
AdminNegotiatorTest class Drupal\Tests\user\Unit\Theme core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php Tests AdminNegotiator class.
AdminPathConfigEntityConverter class Drupal\Core\ProxyClass\ParamConverter core/lib/Drupal/Core/ProxyClass/ParamConverter/AdminPathConfigEntityConverter.php Provides a proxy class for \Drupal\Core\ParamConverter\AdminPathConfigEntityConverter.
AdminPathConfigEntityConverter class Drupal\Core\ParamConverter core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php Makes sure the unmodified ConfigEntity is loaded on admin pages.
AdminPathEntityConverterLanguageTest class Drupal\Tests\language\Functional core/modules/language/tests/src/Functional/AdminPathEntityConverterLanguageTest.php Test administration path based conversion of entities.
AdminRouteSubscriber class Drupal\system\EventSubscriber core/modules/system/src/EventSubscriber/AdminRouteSubscriber.php Adds the _admin_route option to each admin HTML route.
AdminRouteSubscriberTest class Drupal\Tests\system\Unit\Routing core/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php Tests Drupal\system\EventSubscriber\AdminRouteSubscriber.
AdminTest class Drupal\Tests\system\Functional\System core/modules/system/tests/src/Functional/System/AdminTest.php Tests output on administrative pages and compact mode functionality.
AdminUiTest class Drupal\Tests\ckeditor5\FunctionalJavascript core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php Tests for CKEditor 5 in the admin UI.
AdvancedSettingsForm class Drupal\views_ui\Form core/modules/views_ui/src/Form/AdvancedSettingsForm.php Form builder for the advanced admin settings page.
AdvisoriesConfigSubscriber class Drupal\system\EventSubscriber core/modules/system/src/EventSubscriber/AdvisoriesConfigSubscriber.php Defines a config subscriber for changes to 'system.advisories'.
AdvisoryFeedTestHooks class Drupal\advisory_feed_test\Hook core/modules/system/tests/modules/advisory_feed_test/src/Hook/AdvisoryFeedTestHooks.php Hook implementations for advisory_feed_test.
AdvisoryTestClientMiddleware class Drupal\advisory_feed_test core/modules/system/tests/modules/advisory_feed_test/src/AdvisoryTestClientMiddleware.php Overrides the User-Agent HTTP header for outbound HTTP requests.
AdvisoryTestController class Drupal\advisory_feed_test\Controller core/modules/system/tests/modules/advisory_feed_test/src/Controller/AdvisoryTestController.php Defines a controller to return JSON for security advisory tests.
AfterCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/AfterCommand.php An AJAX command for calling the jQuery after() method.
AggregationTest class Drupal\Tests\views\Kernel core/modules/views/tests/src/Kernel/AggregationTest.php A basic aggregation test for Views.
AHooks class Drupal\aaa_hook_order_test\Hook core/modules/system/tests/modules/HookOrder/aaa_hook_order_test/src/Hook/AHooks.php Provides hook implementations for testing the execution order of hooks.
AjaxBasePageNegotiator class Drupal\Core\Theme core/lib/Drupal/Core/Theme/AjaxBasePageNegotiator.php Defines a theme negotiator that deals with the active theme on ajax requests.
AjaxBasePageNegotiatorTest class Drupal\Tests\Core\Theme core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php Tests Drupal\Core\Theme\AjaxBasePageNegotiator.
AjaxBlockTest class Drupal\Tests\layout_builder\FunctionalJavascript core/modules/layout_builder/tests/src/FunctionalJavascript/AjaxBlockTest.php Ajax blocks tests.
AjaxCallbacksTest class Drupal\FunctionalJavascriptTests\Ajax core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxCallbacksTest.php Tests Ajax callbacks on FAPI elements.
AjaxCommandsTest class Drupal\Tests\Core\Ajax core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php Test coverage for various classes in the \Drupal\Core\Ajax namespace.

Other projects


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