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
StubEntityBase class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/StubEntityBase.php A stub base entity for testing purposes. 1 1
StubEntityHandlerBase class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/StubEntityHandlerBase.php A stub base entity handler for testing purposes.
StubEntityStorageBase class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/StubEntityStorageBase.php A stub base entity storage for testing purposes.
StubFallbackPluginManager class Drupal\Tests\Component\Plugin core/tests/Drupal/Tests/Component/Plugin/StubFallbackPluginManager.php Stubs \Drupal\Component\Plugin\FallbackPluginManagerInterface.
StubFieldItemBase class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/StubFieldItemBase.php A stub field item base entity for testing purposes.
StubForm class Drupal\Tests\system\Functional\Form core/modules/system/tests/src/Functional/Form/StubForm.php Provides a stub form for testing purposes.
StubFormSubmitter class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/StubFormSubmitter.php Provides a stub FormSubmitter that doesn't depend on batch_get().
StubLockBackendAbstract class Drupal\Tests\Core\Lock core/tests/Drupal/Tests/Core/Lock/StubLockBackendAbstract.php A stub of the abstract LockBackendAbstract class for testing purposes.
StubNegotiationMiddleware class Drupal\Tests\Core\StackMiddleware core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php Stub class for testing NegotiationMiddleware.
StubPagerPluginBase class Drupal\Tests\views\Unit\Plugin\pager core/modules/views/tests/src/Unit/Plugin/pager/StubPagerPluginBase.php A stub pager plugin for testing purposes.
StubPathMatcher class Drupal\Tests\system\Kernel\Block core/modules/system/tests/src/Kernel/Block/StubPathMatcher.php A class extending PatchMatcher for testing purposes.
StubPDO

in drupal:11.5.0 and is removed from drupal:12.0.0. No replacement provided.

class Drupal\Tests\Core\Database\Stub core/tests/Drupal/Tests/Core/Database/Stub/StubPDO.php A stub of \PDO for testing purposes.
StubPluginBase class Drupal\Tests\Component\Plugin core/tests/Drupal/Tests/Component/Plugin/StubPluginBase.php A class extending PluginBase for testing purposes.
StubPluginManagerBase class Drupal\Tests\Component\Plugin core/tests/Drupal/Tests/Component/Plugin/StubPluginManagerBase.php A class extending PluginManagerBase for testing purposes.
StubPluginManagerBaseWithMapper final class Drupal\Tests\Component\Plugin core/tests/Drupal/Tests/Component/Plugin/StubPluginManagerBaseWithMapper.php Stubs \Drupal\Component\Plugin\PluginManagerBase to take a MapperInterface.
StubReflectionFactory class Drupal\Tests\Component\Plugin\Factory core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php Override ReflectionFactory because ::createInstance() calls a static method.
StubRequestHandlerResourcePlugin class Drupal\Tests\rest\Kernel core/modules/rest/tests/src/Kernel/RequestHandlerTest.php Stub class where we can prophesize methods.
StubRevisionableEntity class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/StubRevisionableEntity.php A stub revisionable entity for testing purposes. 1
StubSchema class Drupal\Tests\Core\Database\Stub core/tests/Drupal/Tests/Core/Database/Stub/StubSchema.php A stub of the abstract Schema class for testing purposes. 1 2
StubSourceGeneratorPlugin class Drupal\Tests\migrate\Unit core/modules/migrate/tests/src/Unit/MigrateSourceTest.php Defines a stubbed source plugin with a generator as iterator.
StubSourcePlugin class Drupal\Tests\migrate\Unit core/modules/migrate/tests/src/Unit/StubSourcePlugin.php Stubbed source plugin for testing base class implementations. 1
StubSqlBase class Drupal\Tests\views\Unit\Plugin\pager core/modules/views/tests/src/Unit/Plugin/pager/StubSqlBase.php A stub pager plugin for testing purposes.
StubTestTrait trait Drupal\Tests\migrate core/modules/migrate/tests/src/StubTestTrait.php Provides common functionality for testing stubbing. 1
StubTestTrait trait Drupal\migrate_drupal\Tests core/modules/migrate_drupal/src/Tests/StubTestTrait.php Provides common functionality for testing stubbing. 8
StubThemeHandler class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php Extends the default theme handler to mock some drupal_ methods.
StubTrait trait Drupal\Component\Discovery core/lib/Drupal/Component/Discovery/StubTrait.php Defines an empty trait that can stand in for a missing trait.
StubUpsert class Drupal\Tests\Core\Database\Stub core/tests/Drupal/Tests/Core/Database/Stub/StubUpsert.php A stub of core Upsert for testing purposes.
StubVariableTestClass class Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/VariableTest.php No-op test class for VariableTest::testExport().
StubVariantBase class Drupal\Tests\Core\Display core/tests/Drupal/Tests/Core/Display/DisplayVariantTest.php Provides a basic class extending VariantBase.
Style class Drupal\ckeditor5\Plugin\CKEditor5Plugin core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php CKEditor 5 Style plugin configuration. 3 1
StyleFieldsTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/StyleFieldsTest.php Tests fields style functionality.
StyleGridResponsiveTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/StyleGridResponsiveTest.php Tests the grid_responsive style plugin.
StyleGridTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/StyleGridTest.php Tests the grid style plugin.
StyleHtmlListTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/StyleHtmlListTest.php Tests the HTML list style plugin.
StyleMappingTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/StyleMappingTest.php Tests mapping style functionality.
StylePluginBase abstract class Drupal\views\Plugin\views\style core/modules/views/src/Plugin/views/style/StylePluginBase.php Base class for views style plugins. 13 6 1
StylePluginTest class Drupal\Tests\ckeditor5\Unit core/modules/ckeditor5/tests/src/Unit/StylePluginTest.php Tests Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style.
StyleSensibleElementConstraint class Drupal\ckeditor5\Plugin\Validation\Constraint core/modules/ckeditor5/src/Plugin/Validation/Constraint/StyleSensibleElementConstraint.php Styles can only be specified for HTML5 tags and extra classes.
StyleSensibleElementConstraintValidator class Drupal\ckeditor5\Plugin\Validation\Constraint core/modules/ckeditor5/src/Plugin/Validation/Constraint/StyleSensibleElementConstraintValidator.php Styles can only be specified for HTML5 tags and extra classes.
StyleSerializerEntityTest class Drupal\Tests\rest\Functional\Views core/modules/rest/tests/src/Functional/Views/StyleSerializerEntityTest.php Tests the serializer style plugin.
StyleSerializerKernelTest class Drupal\Tests\rest\Kernel\Views core/modules/rest/tests/src/Kernel/Views/StyleSerializerKernelTest.php Tests Drupal\rest\Plugin\views\style\Serializer.
StyleSerializerTest class Drupal\Tests\rest\Functional\Views core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php Tests the serializer style plugin.
StyleSummaryTest class Drupal\Tests\views\Functional\Plugin core/modules/views/tests/src/Functional/Plugin/StyleSummaryTest.php Tests the summary style plugin.
StyleTableTest class Drupal\Tests\views\Functional\Plugin core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php Tests the table style views plugin.
StyleTableTest class Drupal\Tests\views_ui\Functional core/modules/views_ui/tests/src/Functional/StyleTableTest.php Tests the UI of views when using the table style.
StyleTableUnitTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/StyleTableUnitTest.php Tests the table style plugin.
StyleTemplateTest class Drupal\views_test_data\Plugin\views\style core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTemplateTest.php Provides a general test style template plugin.
StyleTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/StyleTest.php Tests general style functionality.
StyleTest class Drupal\views_test_data\Plugin\views\style core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php Provides a general test style plugin. 1
StyleTest class Drupal\Tests\ckeditor5\FunctionalJavascript core/modules/ckeditor5/tests/src/FunctionalJavascript/StyleTest.php Tests Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style.

Other projects


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