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
StateInterface interface Drupal\Core\State core/lib/Drupal/Core/State/StateInterface.php Defines the interface for the state system. 1 83
StateInterface interface Drupal\workflows core/modules/workflows/src/StateInterface.php An interface for state value objects. 2 8
Statement class Drupal\sqlite\Driver\Database\sqlite core/modules/sqlite/src/Driver/Database/sqlite/Statement.php SQLite implementation of \Drupal\Core\Database\Statement. 1 1
Statement

in drupal:9.4.0 and is removed from drupal:11.0.0. The SQLite database driver has been moved to the sqlite module.

class Drupal\Core\Database\Driver\sqlite core/lib/Drupal/Core/Database/Driver/sqlite/Statement.php SQLite implementation of \Drupal\Core\Database\Statement. 1
StatementExecutionEndEvent class Drupal\Core\Database\Event core/lib/Drupal/Core/Database/Event/StatementExecutionEndEvent.php Represents the end of a statement execution as an event. 1 10
StatementExecutionFailureEvent class Drupal\Core\Database\Event core/lib/Drupal/Core/Database/Event/StatementExecutionFailureEvent.php Represents the failure of a statement execution as an event. 6
StatementExecutionStartEvent class Drupal\Core\Database\Event core/lib/Drupal/Core/Database/Event/StatementExecutionStartEvent.php Represents the start of a statement execution as an event. 7
StatementExecutionSubscriber class Drupal\Core\Database\EventSubscriber core/lib/Drupal/Core/Database/EventSubscriber/StatementExecutionSubscriber.php Response subscriber to statement executions.
StatementInterface interface Drupal\Core\Database core/lib/Drupal/Core/Database/StatementInterface.php Represents a prepared statement. 6 11
StatementIteratorTrait trait Drupal\Core\Database core/lib/Drupal/Core/Database/StatementIteratorTrait.php StatementInterface iterator trait.
StatementPrefetch

in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Database\StatementPrefetchIterator instead.

class Drupal\Core\Database core/lib/Drupal/Core/Database/StatementPrefetch.php An implementation of StatementInterface that pre-fetches all data. 1
StatementPrefetchIterator class Drupal\Core\Database core/lib/Drupal/Core/Database/StatementPrefetchIterator.php An implementation of StatementInterface that prefetches all data. 1 2
StatementTest class Drupal\KernelTests\Core\Database core/tests/Drupal/KernelTests/Core/Database/StatementTest.php Tests the Statement classes.
StatementWrapper

in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Database\StatementWrapperIterator instead.

class Drupal\Core\Database core/lib/Drupal/Core/Database/StatementWrapper.php Implementation of StatementInterface encapsulating PDOStatement. 2
StatementWrapperIterator class Drupal\Core\Database core/lib/Drupal/Core/Database/StatementWrapperIterator.php StatementInterface iterator implementation. 2
StateTest class Drupal\Tests\workflows\Unit core/modules/workflows/tests/src/Unit/StateTest.php @coversDefaultClass \Drupal\workflows\State[[api-linebreak]]
StateTransitionValidation class Drupal\content_moderation core/modules/content_moderation/src/StateTransitionValidation.php Validates whether a certain state transition is allowed. 1 2
StateTransitionValidationInterface interface Drupal\content_moderation core/modules/content_moderation/src/StateTransitionValidationInterface.php Validates whether a certain state transition is allowed. 1 3
StateTransitionValidationTest class Drupal\Tests\content_moderation\Unit core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php @coversDefaultClass \Drupal\content_moderation\StateTransitionValidation[[api-linebreak]] @group content_moderation
StateValuesCleanAdvancedTest class Drupal\Tests\system\Functional\Form core/modules/system/tests/src/Functional/Form/StateValuesCleanAdvancedTest.php Tests the removal of internal Form API elements from submitted form values.
StateValuesCleanTest class Drupal\Tests\system\Functional\Form core/modules/system/tests/src/Functional/Form/StateValuesCleanTest.php Tests the proper removal of submitted form values.
StaticDiscovery class Drupal\Component\Plugin\Discovery core/lib/Drupal/Component/Plugin/Discovery/StaticDiscovery.php Allows plugin definitions to be manually registered. 2 6
StaticDiscoveryDecorator class Drupal\Component\Plugin\Discovery core/lib/Drupal/Component/Plugin/Discovery/StaticDiscoveryDecorator.php A decorator that allows manual registration of undiscoverable definitions. 2
StaticDiscoveryDecoratorTest class Drupal\Tests\Component\Plugin\Discovery core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php @group Plugin @coversDefaultClass \Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator[[api-linebreak]]
StaticDiscoveryDecoratorTestMockInterface interface Drupal\Tests\Component\Plugin\Discovery core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php Interface used in the mocking process of this test.
StaticDiscoveryTest class Drupal\KernelTests\Core\Plugin\Discovery core/tests/Drupal/KernelTests/Core/Plugin/Discovery/StaticDiscoveryTest.php Tests that plugins using static discovery are correctly discovered.
StaticDiscoveryTestDecoratedClass class Drupal\Tests\Component\Plugin\Discovery core/tests/Drupal/Tests/Component/Plugin/Discovery/StaticDiscoveryDecoratorTest.php A class extending StaticDiscovery for testing purposes.
StaticFileCacheBackend class Drupal\Tests\Component\FileCache core/tests/Drupal/Tests/Component/FileCache/StaticFileCacheBackend.php Allows to cache data based on file modification dates in a static cache.
StaticMap class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/StaticMap.php Changes the source value based on a static lookup map. 3 4
StaticMapTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/StaticMapTest.php Tests the static map process plugin.
StaticMenuLinkOverrides class Drupal\Core\Menu core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php Defines an implementation of the menu link override using a config file. 1 2
StaticMenuLinkOverridesInterface interface Drupal\Core\Menu core/lib/Drupal/Core/Menu/StaticMenuLinkOverridesInterface.php Defines an interface for objects which overrides menu links defined in YAML. 1 4
StaticMenuLinkOverridesTest class Drupal\Tests\Core\Menu core/tests/Drupal/Tests/Core/Menu/StaticMenuLinkOverridesTest.php @coversDefaultClass \Drupal\Core\Menu\StaticMenuLinkOverrides[[api-linebreak]] @group Menu
StaticReflectionClass class Drupal\Component\Annotation\Doctrine core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionClass.php
StaticReflectionParser class Drupal\Component\Annotation\Doctrine core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php Parses a file for namespaces/use/class declarations. 1 6
StaticReflectionParser class Drupal\migrate\Plugin\Discovery core/modules/migrate/src/Plugin/Discovery/StaticReflectionParser.php Allows getting the reflection parser for the parent class.
StaticReflectionParserTest class Drupal\Tests\Component\Annotation\Doctrine core/tests/Drupal/Tests/Component/Annotation/Doctrine/StaticReflectionParserTest.php @coversDefaultClass \Drupal\Component\Annotation\Doctrine\StaticReflectionParser[[api-linebreak]]
StaticTest class Drupal\views_test_data\Plugin\views\access core/modules/views/tests/modules/views_test_data/src/Plugin/views/access/StaticTest.php Tests a static access plugin.
StaticTranslation class Drupal\Core\StringTranslation\Translator core/lib/Drupal/Core/StringTranslation/Translator/StaticTranslation.php String translator with a static cache for translations. 2
StaticTrustedCallbackHelper class Drupal\Core\Security core/lib/Drupal/Core/Security/StaticTrustedCallbackHelper.php Defines a class for performing trusted callbacks in a static context. 2
StatisticsAdminTest class Drupal\Tests\statistics\Functional core/modules/statistics/tests/src/Functional/StatisticsAdminTest.php Tests the statistics admin.
StatisticsAttachedTest class Drupal\Tests\statistics\Functional core/modules/statistics/tests/src/Functional/StatisticsAttachedTest.php Tests if statistics.js is loaded when content is not printed.
StatisticsLastCommentName class Drupal\comment\Plugin\views\sort core/modules/comment/src/Plugin/views/sort/StatisticsLastCommentName.php Sort handler, sorts by last comment name which can be in 2 different fields.
StatisticsLastCommentName class Drupal\comment\Plugin\views\field core/modules/comment/src/Plugin/views/field/StatisticsLastCommentName.php Field handler to present the name of the last comment poster.
StatisticsLastUpdated class Drupal\comment\Plugin\views\sort core/modules/comment/src/Plugin/views/sort/StatisticsLastUpdated.php Sort handler for the newer of last comment / entity updated.
StatisticsLastUpdated class Drupal\comment\Plugin\views\field core/modules/comment/src/Plugin/views/field/StatisticsLastUpdated.php Field handler to display the newer of last comment / node updated.
StatisticsLastUpdated class Drupal\comment\Plugin\views\filter core/modules/comment/src/Plugin/views/filter/StatisticsLastUpdated.php Filter handler for the newer of last comment / node updated.
StatisticsLoggingTest class Drupal\Tests\statistics\FunctionalJavascript core/modules/statistics/tests/src/FunctionalJavascript/StatisticsLoggingTest.php Tests that statistics works.
StatisticsLoggingTest class Drupal\Tests\statistics\Functional core/modules/statistics/tests/src/Functional/StatisticsLoggingTest.php Tests request logging for cached and uncached pages.
StatisticsNumeric class Drupal\statistics\Plugin\views\field core/modules/statistics/src/Plugin/views/field/StatisticsNumeric.php Field handler to display numeric values from the statistics module.

Other projects


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