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
Service class Drupal\new_dependency_test core/modules/system/tests/modules/new_dependency_test/src/Service.php A service that can decorated itself. 5
ServiceClassDefault class Drupal\Tests\Core\DependencyInjection\Compiler core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php A class used for testing the backend compiler passes. 3
ServiceClassDriverTestMysql class Drupal\Tests\Core\DependencyInjection\Compiler core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php A class used for testing the backend compiler passes.
ServiceClassMariaDb class Drupal\Tests\Core\DependencyInjection\Compiler core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php A class used for testing the backend compiler passes.
ServiceClassMysql class Drupal\Tests\Core\DependencyInjection\Compiler core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php A class used for testing the backend compiler passes. 1
ServiceClassSqlite class Drupal\Tests\Core\DependencyInjection\Compiler core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php A class used for testing the backend compiler passes.
ServiceDeprecationTest class Drupal\FunctionalTests\Core\Container core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php Test whether deprecation notices are triggered via \Drupal::service().
ServiceDestructionTest class Drupal\KernelTests\Core\DrupalKernel core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php Tests that services are correctly destructed.
ServiceModifierInterface interface Drupal\Core\DependencyInjection core/lib/Drupal/Core/DependencyInjection/ServiceModifierInterface.php Interface that service providers can implement to modify services. 14 15
ServiceProviderBase abstract class Drupal\Core\DependencyInjection core/lib/Drupal/Core/DependencyInjection/ServiceProviderBase.php Base service provider implementation. 9 9
ServiceProviderInterface interface Drupal\Core\DependencyInjection core/lib/Drupal/Core/DependencyInjection/ServiceProviderInterface.php Interface that all service providers must implement. 15 15
ServiceProviderTest class Drupal\KernelTests\Core\ServiceProvider core/tests/Drupal/KernelTests/Core/ServiceProvider/ServiceProviderTest.php Tests service provider registration to the DIC.
ServiceProviderTestServiceProvider class Drupal\service_provider_test core/modules/system/tests/modules/service_provider_test/src/ServiceProviderTestServiceProvider.php Service provider for service provider testing module.
ServiceProviderWebTest class Drupal\Tests\system\Functional\ServiceProvider core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php Tests service provider registration to the DIC.
ServicesDefaultsTest class Drupal\KernelTests\Core\DependencyInjection core/tests/Drupal/KernelTests/Core/DependencyInjection/ServicesDefaultsTest.php Tests services _defaults definition.
ServicesTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/ServicesTest.php Tests that Package Manager services are wired correctly.
ServiceWithDependency class Drupal\new_dependency_test core/modules/system/tests/modules/new_dependency_test/src/ServiceWithDependency.php Service that gets the other service of the same module injected. 6
Session class Drupal\Core\StackMiddleware core/lib/Drupal/Core/StackMiddleware/Session.php Wrap session logic around a HTTP request. 2
SessionAuthenticationTest class Drupal\Tests\system\Functional\Session core/modules/system/tests/src/Functional/Session/SessionAuthenticationTest.php Tests if sessions are correctly handled when a user authenticates.
SessionCacheContext class Drupal\Core\Cache\Context core/lib/Drupal/Core/Cache/Context/SessionCacheContext.php Defines the SessionCacheContext service, for "per session" caching. 1 2
SessionCacheContextTest class Drupal\Tests\Core\Cache\Context core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php Tests Drupal\Core\Cache\Context\SessionCacheContext.
SessionConfiguration class Drupal\Core\Session core/lib/Drupal/Core/Session/SessionConfiguration.php Defines the default session configuration generator. 2 2
SessionConfigurationInterface interface Drupal\Core\Session core/lib/Drupal/Core/Session/SessionConfigurationInterface.php Defines an interface for session configuration generators. 1 11
SessionConfigurationTest class Drupal\Tests\Core\Session core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php Tests Drupal\Core\Session\SessionConfiguration.
SessionExistsCacheContext class Drupal\Core\Cache\Context core/lib/Drupal/Core/Cache/Context/SessionExistsCacheContext.php Defines the SessionExistsCacheContext service, for "session or not" caching. 2
SessionExistsCacheContextTest class Drupal\Tests\system\Functional\Cache core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php Tests the 'session.exists' cache context service.
SessionExistsCacheContextTestHooks class Drupal\session_exists_cache_context_test\Hook core/modules/system/tests/modules/session_exists_cache_context_test/src/Hook/SessionExistsCacheContextTestHooks.php Hook implementations for session_exists_cache_context_test.
SessionHandler class Drupal\Core\Session core/lib/Drupal/Core/Session/SessionHandler.php Default session handler. 2
SessionHttpsTest class Drupal\Tests\system\Functional\Session core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php Ensure that when running under HTTPS two session cookies are generated.
SessionManager class Drupal\Core\Session core/lib/Drupal/Core/Session/SessionManager.php Manages user sessions. 1 2
SessionManagerDestroyNoCliCheckTest class Drupal\KernelTests\Core\Session core/tests/Drupal/KernelTests/Core/Session/SessionManagerDestroyNoCliCheckTest.php Tests starting and destroying a session from the CLI.
SessionManagerInterface interface Drupal\Core\Session core/lib/Drupal/Core/Session/SessionManagerInterface.php Defines the session manager interface. 1
SessionManagerTest class Drupal\Tests\Core\Session core/tests/Drupal/Tests/Core/Session/SessionManagerTest.php Tests Drupal\Core\Session\SessionManager.
SessionTest class Drupal\Tests\system\Functional\Session core/modules/system/tests/src/Functional/Session/SessionTest.php Drupal session handling tests.
SessionTest class Drupal\FunctionalJavascriptTests\Core\Session core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php Tests that sessions don't expire.
SessionTestController class Drupal\session_test\Controller core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php Controller providing page callbacks for session tests.
SessionTestForm class Drupal\session_test\Form core/modules/system/tests/modules/session_test/src/Form/SessionTestForm.php Form controller for the test config edit forms. 1
SessionTestHooks class Drupal\session_test\Hook core/modules/system/tests/modules/session_test/src/Hook/SessionTestHooks.php Hook implementations for session_test.
SessionTestSubscriber class Drupal\session_test\EventSubscriber core/modules/system/tests/modules/session_test/src/EventSubscriber/SessionTestSubscriber.php Defines a test session subscriber that checks whether the session is empty. 2
SessionTestTrait trait Drupal\Tests core/tests/Drupal/Tests/SessionTestTrait.php Provides methods to generate and get session name in tests. 1
SessionWorkspaceNegotiator class Drupal\workspaces\Negotiator core/modules/workspaces/src/Negotiator/SessionWorkspaceNegotiator.php Defines the session workspace negotiator. 1 2
SetBrowserUrl class Drupal\views\Ajax core/modules/views/src/Ajax/SetBrowserUrl.php AJAX command that sets the browser URL without refreshing the page. 1
SetCustomize class Drupal\shortcut\Form core/modules/shortcut/src/Form/SetCustomize.php Builds the shortcut set customize form. 1
SetDialogOptionCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/SetDialogOptionCommand.php Defines an AJAX command that sets jQuery UI dialog properties. 1 1
SetDialogTitleCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/SetDialogTitleCommand.php Defines an AJAX command that sets jQuery UI dialog properties. 1
SetFormCommand class Drupal\views_ui\Ajax core/modules/views_ui/src/Ajax/SetFormCommand.php Provides an AJAX command for setting a form submit URL in modal forms. 1
SetInlineBlockDependency class Drupal\layout_builder\EventSubscriber core/modules/layout_builder/src/EventSubscriber/SetInlineBlockDependency.php An event subscriber that returns an access dependency for inline blocks. 1
SetProperties final class Drupal\Core\Config\Action\Plugin\ConfigAction core/lib/Drupal/Core/Config/Action/Plugin/ConfigAction/SetProperties.php @internal This API is experimental.
SetSubtreesCommand class Drupal\toolbar\Ajax core/modules/toolbar/src/Ajax/SetSubtreesCommand.php Defines an AJAX command that sets the toolbar subtrees. 1
SettableDiscoveryExtensionListTrait trait Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php Trait that allows extension discovery to be set.

Other projects


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