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
StringFormatter class Drupal\Core\Field\Plugin\Field\FieldFormatter core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php Plugin implementation of the 'string' formatter. 2 1
StringFormatterTest class Drupal\Tests\field\Kernel\KernelString core/modules/field/tests/src/Kernel/KernelString/StringFormatterTest.php Tests the creation of text fields.
StringIdEntityTest class Drupal\migrate_entity_test\Entity core/modules/migrate/tests/modules/migrate_entity_test/src/Entity/StringIdEntityTest.php Defines a content entity type that has a string ID. 1
StringInterface interface Drupal\Core\TypedData\Type core/lib/Drupal/Core/TypedData/Type/StringInterface.php Interface for strings. 2 8
StringInterface interface Drupal\locale core/modules/locale/src/StringInterface.php Defines the locale string interface. 1 3
StringItem class Drupal\Core\Field\Plugin\Field\FieldType core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItem.php Defines the 'string' entity field type. 8 7
StringItemBase abstract class Drupal\Core\Field\Plugin\Field\FieldType core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItemBase.php Base class for string field types. 2
StringItemTest class Drupal\Tests\Core\Field core/tests/Drupal/Tests/Core/Field/StringItemTest.php Defines a test for the StringItem field-type.
StringListField class Drupal\options\Plugin\views\argument core/modules/options/src/Plugin/views/argument/StringListField.php Argument handler for list field to show the human readable name in summary.
StringLoader class Drupal\Core\Template\Loader core/lib/Drupal/Core/Template/Loader/StringLoader.php Loads string templates, also known as inline templates. 3 2
StringLongItem class Drupal\Core\Field\Plugin\Field\FieldType core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringLongItem.php Defines the 'string_long' field type.
StringNormalizer class Drupal\jsonapi_test_data_type\Normalizer core/modules/jsonapi/tests/modules/jsonapi_test_data_type/src/Normalizer/StringNormalizer.php Normalizes string data weirdly: replaces 'super' with 'NOT' and vice versa. 2
StringNormalizer class Drupal\jsonapi_test_field_type\Normalizer core/modules/jsonapi/tests/modules/jsonapi_test_field_type/src/Normalizer/StringNormalizer.php Normalizes string fields weirdly: replaces 'super' with 'NOT' and vice versa. 2
StringObject class Drupal\Tests\Component\Assertion core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php Quick class for testing for objects with __toString.
StringStorageException class Drupal\locale core/modules/locale/src/StringStorageException.php Defines an exception thrown when storage operations fail. 1
StringStorageInterface interface Drupal\locale core/modules/locale/src/StringStorageInterface.php Defines the locale string storage interface. 1 3
StringTextareaWidget class Drupal\Core\Field\Plugin\Field\FieldWidget core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextareaWidget.php Plugin implementation of the 'string_textarea' widget. 1 1
StringTextfieldWidget class Drupal\Core\Field\Plugin\Field\FieldWidget core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/StringTextfieldWidget.php Plugin implementation of the 'string_textfield' widget. 2 2
StringTranslationTrait trait Drupal\Core\StringTranslation core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface. 169
StringTranslationTraitTest class Drupal\Tests\Core\StringTranslation core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php @coversDefaultClass \Drupal\Core\StringTranslation\StringTranslationTrait[[api-linebreak]] @group StringTranslation
StubCondition class Drupal\Tests\Core\Database\Stub core/tests/Drupal/Tests/Core/Database/Stub/StubCondition.php A stub of core Condition class for testing purposes. 1
StubConnection class Drupal\Tests\Core\Database\Stub core/tests/Drupal/Tests/Core/Database/Stub/StubConnection.php A stub of the abstract Connection class for testing purposes. 7
StubFallbackPluginManager class Drupal\Tests\Component\Plugin core/tests/Drupal/Tests/Component/Plugin/StubFallbackPluginManager.php Stubs \Drupal\Component\Plugin\FallbackPluginManagerInterface.
StubForm class Drupal\Tests\system\Functional\Form core/modules/system/tests/src/Functional/Form/StubForm.php Provides a stub form for testing purposes.
StubNegotiationMiddleware class Drupal\Tests\Core\StackMiddleware core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php
StubPDO class Drupal\Tests\Core\Database\Stub core/tests/Drupal/Tests/Core/Database/Stub/StubPDO.php A stub of \PDO for testing purposes. 12
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.
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/MigrateSourceTest.php Stubbed source plugin for testing base class implementations. 1
StubTestSuiteBase class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php Stub subclass of TestSuiteBase.
StubTestTrait trait Drupal\migrate_drupal\Tests core/modules/migrate_drupal/src/Tests/StubTestTrait.php Provides common functionality for testing stubbing. 9
StubThemeHandler class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php Extends the default theme handler to mock some drupal_ methods.
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().
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 4 1
StylePluginTest class Drupal\Tests\ckeditor5\Unit core/modules/ckeditor5/tests/src/Unit/StylePluginTest.php @coversDefaultClass \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style[[api-linebreak]] @group ckeditor5 @internal
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 @coversDefaultClass \Drupal\rest\Plugin\views\style\Serializer[[api-linebreak]] @group views
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.

Other projects


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