Classes, traits, and interfaces - 10.3.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 1518

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
ServiceDestructionTest class Drupal\KernelTests\Core\DrupalKernel core/tests/Drupal/KernelTests/Core/DrupalKernel/ServiceDestructionTest.php Tests that services are correctly destructed.
ServiceIdHashTrait

in drupal:9.5.1 and is removed from drupal:11.0.0. Use the 'Drupal\Component\DependencyInjection\ReverseContainer' service instead.

trait Drupal\Component\DependencyInjection core/lib/Drupal/Component/DependencyInjection/ServiceIdHashTrait.php A trait for service id hashing implementations. 1
ServiceModifierInterface interface Drupal\Core\DependencyInjection core/lib/Drupal/Core/DependencyInjection/ServiceModifierInterface.php Interface that service providers can implement to modify services. 10 11
ServiceProviderBase abstract class Drupal\Core\DependencyInjection core/lib/Drupal/Core/DependencyInjection/ServiceProviderBase.php Base service provider implementation. 5 5
ServiceProviderInterface interface Drupal\Core\DependencyInjection core/lib/Drupal/Core/DependencyInjection/ServiceProviderInterface.php Interface that all service providers must implement. 14 14
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
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.
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 @coversDefaultClass \Drupal\Core\Cache\Context\SessionCacheContext[[api-linebreak]] @group Cache
SessionConfiguration class Drupal\Core\Session core/lib/Drupal/Core/Session/SessionConfiguration.php Defines the default session configuration generator. 2
SessionConfigurationInterface interface Drupal\Core\Session core/lib/Drupal/Core/Session/SessionConfigurationInterface.php Defines an interface for session configuration generators. 1 7
SessionConfigurationTest class Drupal\Tests\Core\Session core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php @coversDefaultClass \Drupal\Core\Session\SessionConfiguration[[api-linebreak]] @group Session
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.
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. 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
SessionTest class Drupal\FunctionalJavascriptTests\Core\Session core/tests/Drupal/FunctionalJavascriptTests/Core/Session/SessionTest.php Tests that sessions don't expire.
SessionTest class Drupal\Tests\system\Functional\Session core/modules/system/tests/src/Functional/Session/SessionTest.php Drupal session handling tests.
SessionTestController class Drupal\session_test\Controller core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php Controller providing page callbacks for the action admin interface.
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
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
SetCustomize class Drupal\shortcut\Form core/modules/shortcut/src/Form/SetCustomize.php Builds the shortcut set customize form.
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
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.
SetterInjection class Drupal\new_dependency_test core/modules/system/tests/modules/new_dependency_test/src/SetterInjection.php Generic service which uses setter injection. 2
Settings final class Drupal\Core\Site core/lib/Drupal/Core/Site/Settings.php Read only settings that are initialized with the class. 138 2
SettingsAnnotation class Drupal\Tests\Component\Annotation\Doctrine core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
SettingsCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/SettingsCommand.php AJAX command for adjusting Drupal's JavaScript settings. 3
SettingsConfigValidationTest class Drupal\Tests\image\Kernel core/modules/image/tests/src/Kernel/SettingsConfigValidationTest.php @group image
SettingsEditor final class Drupal\Core\Site core/lib/Drupal/Core/Site/SettingsEditor.php Generates settings.php files for Drupal installations. 4
SettingsForm final class Drupal\navigation\Form core/modules/navigation/src/Form/SettingsForm.php Configure Navigation settings for this site. 1
SettingsForm class Drupal\media_library\Form core/modules/media_library/src/Form/SettingsForm.php Defines a form for configuring the Media Library module. 1
SettingsFormTest class Drupal\Tests\media_library\Functional core/modules/media_library/tests/src/Functional/SettingsFormTest.php Tests the Media Library settings form.
SettingsFormTest class Drupal\Tests\jsonapi\Functional core/modules/jsonapi/tests/src/Functional/SettingsFormTest.php @covers \Drupal\jsonapi\Form\JsonApiSettingsForm[[api-linebreak]] @group jsonapi
SettingsRewriteTest class Drupal\KernelTests\Core\Site core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php Tests the SettingsEditor::rewrite() function.
SettingsTest class Drupal\Tests\Core\Site core/tests/Drupal/Tests/Core/Site/SettingsTest.php @coversDefaultClass \Drupal\Core\Site\Settings[[api-linebreak]] @runTestsInSeparateProcesses @group Site

Other projects


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