Classes, traits, and interfaces - 9.5.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 1523

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
Serializer class Drupal\rest\Plugin\views\style core/modules/rest/src/Plugin/views/style/Serializer.php The style plugin for serialized output formats. 1
SerializerTest class Drupal\Tests\rest\Unit\Plugin\views\style core/modules/rest/tests/src/Unit/Plugin/views/style/SerializerTest.php @coversDefaultClass \Drupal\rest\Plugin\views\style\Serializer[[api-linebreak]] @group rest
SerializerTest class Drupal\Tests\jsonapi\Kernel\Serializer core/modules/jsonapi/tests/src/Kernel/Serializer/SerializerTest.php Tests the JSON:API serializer.
ServerCommand class Drupal\Core\Command core/lib/Drupal/Core/Command/ServerCommand.php Runs the PHP webserver for a Drupal site for local testing/development.
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 3
ServiceClassDrivertestMysql class Drupal\Tests\Core\DependencyInjection\Compiler core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
ServiceClassMariaDb class Drupal\Tests\Core\DependencyInjection\Compiler core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
ServiceClassMysql class Drupal\Tests\Core\DependencyInjection\Compiler core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php 1
ServiceClassSqlite class Drupal\Tests\Core\DependencyInjection\Compiler core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/BackendCompilerPassTest.php
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.
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. 11 12
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. 12 12
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 8
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. 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 @coversDefaultClass \Drupal\Core\Session\SessionManager[[api-linebreak]] @group Session
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.

Other projects


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