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
Log class Drupal\Core\Database core/lib/Drupal/Core/Database/Log.php Database query logger. 3
Log class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/Log.php Logs values without changing them. 1
LoggedStatementsTrait

in drupal:10.1.0 and is removed from drupal:11.0.0. There is no replacement.

trait Drupal\database_statement_monitoring_test core/modules/system/tests/modules/database_statement_monitoring_test/src/LoggedStatementsTrait.php Trait for Connection classes that can store logged statements. 3
LoggerAwarePass class Drupal\Core\DependencyInjection\Compiler core/lib/Drupal/Core/DependencyInjection/Compiler/LoggerAwarePass.php Sets the logger on all services that implement LoggerAwareInterface. 1
LoggerAwarePassTest class Drupal\Tests\system\Kernel\DependencyInjection\CompilerPass core/modules/system/tests/src/Kernel/DependencyInjection/CompilerPass/LoggerAwarePassTest.php Tests the logger aware compiler pass.
LoggerAwareStub class Drupal\logger_aware_test core/modules/system/tests/modules/logger_aware_test/src/LoggerAwareStub.php A test class that implements LoggerAwareInterface. 1 3
LoggerChannel class Drupal\Core\Logger core/lib/Drupal/Core/Logger/LoggerChannel.php Defines a logger channel that most implementations will use. 1 2 5
LoggerChannelFactory class Drupal\Core\Logger core/lib/Drupal/Core/Logger/LoggerChannelFactory.php Defines a factory for logging channels. 1 2 2
LoggerChannelFactoryInterface interface Drupal\Core\Logger core/lib/Drupal/Core/Logger/LoggerChannelFactoryInterface.php Logger channel factory interface. 1 11
LoggerChannelFactoryTest class Drupal\Tests\Core\Logger core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php @coversDefaultClass \Drupal\Core\Logger\LoggerChannelFactory[[api-linebreak]] @group Logger
LoggerChannelInterface interface Drupal\Core\Logger core/lib/Drupal/Core/Logger/LoggerChannelInterface.php Logger channel interface. 1 4
LoggerChannelTest class Drupal\Tests\Core\Logger core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php @coversDefaultClass \Drupal\Core\Logger\LoggerChannel[[api-linebreak]] @group Logger
LoggerChannelTrait trait Drupal\Core\Logger core/lib/Drupal/Core/Logger/LoggerChannelTrait.php Wrapper methods for the logger factory service. 7
LoggerChannelWithoutConstructor class Drupal\Tests\Core\Logger core/tests/Drupal/Tests/Core/Logger/LoggerChannelFactoryTest.php
LoggerStub class Drupal\logger_aware_test core/modules/system/tests/modules/logger_aware_test/src/LoggerStub.php A logger stub. 1 2
LoggingForm class Drupal\system\Form core/modules/system/src/Form/LoggingForm.php Configure logging settings for this site. 2
LoggingTest class Drupal\KernelTests\Core\Database core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php Tests the query logging facility.
LoginLogoutMenuLink class Drupal\user\Plugin\Menu core/modules/user/src/Plugin/Menu/LoginLogoutMenuLink.php A menu link that shows "Log in" or "Log out" as appropriate. 1
LoginStatusCheck class Drupal\user\Access core/modules/user/src/Access/LoginStatusCheck.php Determines access to routes based on login status of current user. 2
LogMessageParser class Drupal\Core\Logger core/lib/Drupal/Core/Logger/LogMessageParser.php Parses log messages and their placeholders. 1 2
LogMessageParserInterface interface Drupal\Core\Logger core/lib/Drupal/Core/Logger/LogMessageParserInterface.php Defines an interface for parsing log messages and their placeholders. 1 2
LogMessageParserTest class Drupal\Tests\Core\Logger core/tests/Drupal/Tests/Core/Logger/LogMessageParserTest.php @coversDefaultClass \Drupal\Core\Logger\LogMessageParser[[api-linebreak]] @group Logger
LogTest class Drupal\Tests\Core\Database core/tests/Drupal/Tests/Core/Database/LogTest.php Tests the Log class.
LogTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/LogTest.php Tests the Log process plugin.
LogTest class Drupal\Tests\migrate\Kernel\Plugin core/modules/migrate/tests/src/Kernel/Plugin/LogTest.php Tests the Log process plugin.
LonelyMonkeyClass class Drupal\error_service_test core/modules/system/tests/modules/error_service_test/src/LonelyMonkeyClass.php A class with a single dependency. 1 2
LonelyMonkeyController class Drupal\error_service_test\Controller core/modules/system/tests/modules/error_service_test/src/Controller/LonelyMonkeyController.php Provides a controller which calls out to a service with missing dependencies.
MachineName class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/MachineName.php Creates a machine name. 1
MachineName class Drupal\views\Plugin\views\field core/modules/views/src/Plugin/views/field/MachineName.php Field handler which allows to show machine name content as human name.
MachineName class Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/MachineName.php Provides a machine name render element. 1
MachineNameController

in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement.

class Drupal\system core/modules/system/src/MachineNameController.php Controller routines for machine name transliteration routes. 1
MachineNameControllerTest class Drupal\Tests\system\Unit\Transliteration core/modules/system/tests/src/Unit/Transliteration/MachineNameControllerTest.php Tests that the machine name controller can transliterate strings as expected.
MachineNameTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/MachineNameTest.php Tests the machine name process plugin.
MachineNameTest class Drupal\FunctionalJavascriptTests\Core core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php Tests for the machine name field.
MachineNameTest class Drupal\Tests\Core\Render\Element core/tests/Drupal/Tests/Core/Render/Element/MachineNameTest.php @coversDefaultClass \Drupal\Core\Render\Element\MachineName[[api-linebreak]] @group Render
MachineNameTest class Drupal\KernelTests\Core\Render\Element core/tests/Drupal/KernelTests/Core/Render/Element/MachineNameTest.php @coversDefaultClass \Drupal\Core\Render\Element\MachineName[[api-linebreak]] @group Render
MachineNameTransliterationTest class Drupal\FunctionalJavascriptTests\MachineName core/tests/Drupal/FunctionalJavascriptTests/MachineName/MachineNameTransliterationTest.php Tests the machine name transliteration functionality.
Mail class Drupal\Core\Mail\Attribute core/lib/Drupal/Core/Mail/Attribute/Mail.php Defines a Mail attribute for plugin discovery. 6
Mail class Drupal\Core\Annotation core/lib/Drupal/Core/Annotation/Mail.php Defines a Mail annotation object.
MailCaptureTest class Drupal\FunctionalTests core/tests/Drupal/FunctionalTests/MailCaptureTest.php Tests the collection of emails during testing.
MailDsnSettingsUpdateTest class Drupal\Tests\system\Functional\Update core/modules/system/tests/src/Functional/Update/MailDsnSettingsUpdateTest.php Tests creation of default mail transport dsn settings.
MailFormatHelper class Drupal\Core\Mail core/lib/Drupal/Core/Mail/MailFormatHelper.php Defines a class containing utility methods for formatting mail messages. 8
MailFormatHelperTest class Drupal\Tests\Core\Mail core/tests/Drupal/Tests/Core/Mail/MailFormatHelperTest.php @coversDefaultClass \Drupal\Core\Mail\MailFormatHelper[[api-linebreak]] @group Mail
MailHandler class Drupal\contact core/modules/contact/src/MailHandler.php Provides a class for handling assembly and dispatch of contact mail messages. 1 2
MailHandlerException class Drupal\contact core/modules/contact/src/MailHandlerException.php Exception thrown by MailHandler when unable to determine message recipient. 1
MailHandlerInterface interface Drupal\contact core/modules/contact/src/MailHandlerInterface.php Provides an interface for assembly and dispatch of contact mail messages. 1
MailHandlerTest class Drupal\Tests\contact\Unit core/modules/contact/tests/src/Unit/MailHandlerTest.php @coversDefaultClass \Drupal\contact\MailHandler[[api-linebreak]] @group contact
MailInterface interface Drupal\Core\Mail core/lib/Drupal/Core/Mail/MailInterface.php Defines an interface for pluggable mail back-ends. 4 4 1
MailManager class Drupal\Core\Mail core/lib/Drupal/Core/Mail/MailManager.php Provides a Mail plugin manager. 1 1 2
MailManagerInterface interface Drupal\Core\Mail core/lib/Drupal/Core/Mail/MailManagerInterface.php Provides an interface for sending mail. 1 2

Other projects


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