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 1529

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
AccessTest class Drupal\Tests\file\Kernel core/modules/file/tests/src/Kernel/AccessTest.php Tests for the File access control.
AccessTestBase abstract class Drupal\Tests\user\Functional\Views core/modules/user/tests/src/Functional/Views/AccessTestBase.php A common test base class for the user access plugin tests. 1
AccountCancellation class Drupal\user core/modules/user/src/AccountCancellation.php User account cancellation service. 7
AccountEvents final class Drupal\Core\Session core/lib/Drupal/Core/Session/AccountEvents.php Defines events for the account system. 1
AccountForm abstract class Drupal\user core/modules/user/src/AccountForm.php Form controller for the user account forms. 2
AccountInterface interface Drupal\Core\Session core/lib/Drupal/Core/Session/AccountInterface.php Defines an account interface which represents the current user. 3 430
AccountPermissionsCacheContext class Drupal\Core\Cache\Context core/lib/Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php The account permission cache context for "per permission" caching. 2
AccountProxy class Drupal\Core\Session core/lib/Drupal/Core/Session/AccountProxy.php A proxied implementation of AccountInterface. 1 2
AccountProxyInterface interface Drupal\Core\Session core/lib/Drupal/Core/Session/AccountProxyInterface.php Defines an interface for a service which has the current account stored. 1 28
AccountProxyTest class Drupal\Tests\Core\Session core/tests/Drupal/Tests/Core/Session/AccountProxyTest.php Tests Drupal\Core\Session\AccountProxy.
AccountSetEvent final class Drupal\Core\Session core/lib/Drupal/Core/Session/AccountSetEvent.php Event fired when an account is set for the current session.
AccountSettingsForm class Drupal\user core/modules/user/src/AccountSettingsForm.php Configure user settings for this site. 3 1
AccountSwitcher class Drupal\Core\Session core/lib/Drupal/Core/Session/AccountSwitcher.php An implementation of AccountSwitcherInterface. 2
AccountSwitcherInterface interface Drupal\Core\Session core/lib/Drupal/Core/Session/AccountSwitcherInterface.php Defines an interface for a service for safe account switching. 2 13
AccountSwitcherTest class Drupal\KernelTests\Core\Session core/tests/Drupal/KernelTests/Core/Session/AccountSwitcherTest.php Test case for account switching.
AccountTakeoverGadgetChainTest class Drupal\KernelTests\Core\User core/tests/Drupal/KernelTests/Core/User/AccountTakeoverGadgetChainTest.php Tests protection against SA-CORE-2024-007 Gadget Chain.
ACrossHookReorderAlter class Drupal\aaa_hook_order_test\Hook core/modules/system/tests/modules/HookOrder/aaa_hook_order_test/src/Hook/ACrossHookReorderAlter.php Contains alter hook implementations. 1
Action class Drupal\Core\Annotation core/lib/Drupal/Core/Annotation/Action.php Defines an Action annotation object.
Action class Drupal\Core\Action\Attribute core/lib/Drupal/Core/Action/Attribute/Action.php Defines an Action attribute object. 21
Action class Drupal\system\Entity core/modules/system/src/Entity/Action.php Defines the configured action entity. 17
Action class Drupal\system\Plugin\migrate\source core/modules/system/src/Plugin/migrate/source/Action.php Drupal action source from database. 1
ActionBase abstract class Drupal\Core\Action core/lib/Drupal/Core/Action/ActionBase.php Provides a base implementation for an Action plugin. 10 9
ActionConfigEntityInterface interface Drupal\system core/modules/system/src/ActionConfigEntityInterface.php Provides an interface defining an action entity. 1 4
ActionInterface interface Drupal\Core\Action core/lib/Drupal/Core/Action/ActionInterface.php Provides an interface for an Action plugin. 1 2 1
ActionJsonAnonTest class Drupal\Tests\system\Functional\Rest core/modules/system/tests/src/Functional/Rest/ActionJsonAnonTest.php Tests Action Json Anon.
ActionJsonBasicAuthTest class Drupal\Tests\system\Functional\Rest core/modules/system/tests/src/Functional/Rest/ActionJsonBasicAuthTest.php Tests Action Json Basic Auth.
ActionJsonCookieTest class Drupal\Tests\system\Functional\Rest core/modules/system/tests/src/Functional/Rest/ActionJsonCookieTest.php Tests Action Json Cookie.
ActionManager class Drupal\Core\Action core/lib/Drupal/Core/Action/ActionManager.php Provides an Action plugin manager. 2
ActionMethod final class Drupal\Core\Config\Action\Attribute core/lib/Drupal/Core/Config/Action/Attribute/ActionMethod.php @internal This API is experimental. 17
ActionMethodAttributeTest class Drupal\Tests\Core\Config\Action core/tests/Drupal/Tests/Core/Config/Action/ActionMethodAttributeTest.php Tests Drupal\Core\Config\Action\Attribute\ActionMethod.
ActionPluginCollection class Drupal\Core\Action core/lib/Drupal/Core/Action/ActionPluginCollection.php Provides a container for lazily loading Action plugins. 1
ActionResourceTestBase abstract class Drupal\Tests\system\Functional\Rest core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php Resource test base for the action entity. 6
Actions class Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/Actions.php Provides a wrapper element to group one or more buttons in a form. 1
ActionsTest class Drupal\KernelTests\Core\Render\Element core/tests/Drupal/KernelTests/Core/Render/Element/ActionsTest.php Tests Drupal\Core\Render\Element\Actions.
ActionTest class Drupal\Tests\system\Kernel\Action core/modules/system/tests/src/Kernel/Action/ActionTest.php Tests action plugins.
ActionTest class Drupal\Tests\system\Kernel\Plugin\migrate\source core/modules/system/tests/src/Kernel/Plugin/migrate/source/ActionTest.php Tests actions source plugin.
ActionTest class Drupal\Tests\jsonapi\Functional core/modules/jsonapi/tests/src/Functional/ActionTest.php JSON:API integration test for the "Action" config entity type.
ActionValidationTest class Drupal\Tests\system\Kernel\Entity core/modules/system/tests/src/Kernel/Entity/ActionValidationTest.php Tests validation of action entities.
ActionXmlAnonTest class Drupal\Tests\system\Functional\Rest core/modules/system/tests/src/Functional/Rest/ActionXmlAnonTest.php Tests Action Xml Anon.
ActionXmlBasicAuthTest class Drupal\Tests\system\Functional\Rest core/modules/system/tests/src/Functional/Rest/ActionXmlBasicAuthTest.php Tests Action Xml Basic Auth.
ActionXmlCookieTest class Drupal\Tests\system\Functional\Rest core/modules/system/tests/src/Functional/Rest/ActionXmlCookieTest.php Tests Action Xml Cookie.
ActiveFixtureManipulator final class Drupal\fixture_manipulator core/modules/package_manager/tests/modules/fixture_manipulator/src/ActiveFixtureManipulator.php A fixture manipulator for the active directory. 18
ActiveLinkResponseFilter class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/ActiveLinkResponseFilter.php Subscribes to filter HTML responses, to set attributes on active links. 1 2
ActiveLinkResponseFilterTest class Drupal\Tests\Core\EventSubscriber core/tests/Drupal/Tests/Core/EventSubscriber/ActiveLinkResponseFilterTest.php Tests Drupal\Core\EventSubscriber\ActiveLinkResponseFilter.
ActiveLinkTest class Drupal\Tests\system\FunctionalJavascript core/modules/system/tests/src/FunctionalJavascript/ActiveLinkTest.php Tests active link JS behavior.
ActiveTheme class Drupal\Core\Theme core/lib/Drupal/Core/Theme/ActiveTheme.php Defines a theme and its information needed at runtime. 5
ActiveWorkspaceCheck class Drupal\workspaces\Access core/modules/workspaces/src/Access/ActiveWorkspaceCheck.php Determines access to routes based on the presence of an active workspace. 1 2
ActiveWorkspaceCheckTest class Drupal\Tests\workspaces\Unit core/modules/workspaces/tests/src/Unit/ActiveWorkspaceCheckTest.php Tests Drupal\workspaces\Access\ActiveWorkspaceCheck.
ActiveWorkspaceTestForm class Drupal\workspaces_test\Form core/modules/workspaces/tests/modules/workspaces_test/src/Form/ActiveWorkspaceTestForm.php Form for testing the active workspace. 1 1
ActiveWorkspaceUpdateTest class Drupal\Tests\workspaces\Functional\UpdateSystem core/modules/workspaces/tests/src/Functional/UpdateSystem/ActiveWorkspaceUpdateTest.php Tests that there is no active workspace during database updates.

Other projects


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