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
OEmbedResourceConstraintValidator class Drupal\media\Plugin\Validation\Constraint core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php Validates oEmbed resource URLs. 1
OEmbedResourceConstraintValidatorTest class Drupal\Tests\media\Kernel core/modules/media/tests/src/Kernel/OEmbedResourceConstraintValidatorTest.php @coversDefaultClass \Drupal\media\Plugin\Validation\Constraint\OEmbedResourceConstraintValidator[[api-linebreak]]
OEmbedSourceTest class Drupal\Tests\media\Kernel core/modules/media/tests/src/Kernel/OEmbedSourceTest.php @coversDefaultClass \Drupal\media\Plugin\media\Source\OEmbed[[api-linebreak]]
OEmbedTestTrait trait Drupal\Tests\media\Traits core/modules/media/tests/src/Traits/OEmbedTestTrait.php Contains helper functions for testing oEmbed functionality in isolation. 6
OembedUpdateTest class Drupal\Tests\media\Functional\FieldFormatter core/modules/media/tests/src/Functional/FieldFormatter/OembedUpdateTest.php Tests eager-load upgrade path.
OEmbedWidget class Drupal\media\Plugin\Field\FieldWidget core/modules/media/src/Plugin/Field/FieldWidget/OEmbedWidget.php Plugin implementation of the 'oembed_textfield' widget.
OffCanvasDialogTest class Drupal\Tests\system\Functional\Ajax core/modules/system/tests/src/Functional/Ajax/OffCanvasDialogTest.php Performs tests on opening and manipulating dialogs via AJAX commands.
OffCanvasRenderer class Drupal\Core\Render\MainContent core/lib/Drupal/Core/Render/MainContent/OffCanvasRenderer.php Default main content renderer for off-canvas dialog requests. 3
OffCanvasTest class Drupal\Tests\system\FunctionalJavascript core/modules/system/tests/src/FunctionalJavascript/OffCanvasTest.php Tests the off-canvas dialog functionality.
OffCanvasTestBase abstract class Drupal\Tests\system\FunctionalJavascript core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php Base class contains common test functionality for the Off-canvas dialog. 5 4
OffCanvasTestTrait trait Drupal\Tests\system\Traits core/modules/system/tests/src/Traits/OffCanvasTestTrait.php Provides helper methods for interacting with the off-canvas area. 7
OffsetPage class Drupal\jsonapi\Query core/modules/jsonapi/src/Query/OffsetPage.php Value object for containing the requested offset and page parameters. 3
OffsetPageTest class Drupal\Tests\jsonapi\Unit\Query core/modules/jsonapi/tests/src/Unit/Query/OffsetPageTest.php @coversDefaultClass \Drupal\jsonapi\Query\OffsetPage[[api-linebreak]] @group jsonapi
OliveroHexToHslTest final class Drupal\Tests\olivero\Unit core/themes/olivero/tests/src/Unit/OliveroHexToHslTest.php Tests the _olivero_hex_to_hsl() function.
OliveroMessagesTest class Drupal\FunctionalJavascriptTests\Theme core/tests/Drupal/FunctionalJavascriptTests/Theme/OliveroMessagesTest.php Runs OliveroMessagesTest in Olivero.
OliveroPostUpdateTest class Drupal\Tests\olivero\Functional\Update core/themes/olivero/tests/src/Functional/Update/OliveroPostUpdateTest.php Tests the update path for Olivero.
OliveroPreRender class Drupal\olivero core/themes/olivero/src/OliveroPreRender.php Implements trusted prerender callbacks for the Olivero theme. 1
OliveroTest class Drupal\FunctionalTests\Theme core/tests/Drupal/FunctionalTests/Theme/OliveroTest.php Tests the Olivero theme.
OmittedData class Drupal\jsonapi\JsonApiResource core/modules/jsonapi/src/JsonApiResource/OmittedData.php Represents resource data that should be omitted from the JSON:API document. 1
OpCodeCache class Drupal\Component\Utility core/lib/Drupal/Component/Utility/OpCodeCache.php Provides helpers to handle PHP opcode caches. 3
OpenDialogCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/OpenDialogCommand.php Defines an AJAX command to open certain content in a dialog. 2 3
OpenerResolver class Drupal\media_library core/modules/media_library/src/OpenerResolver.php Defines a class to resolve media library openers. 2
OpenerResolverInterface interface Drupal\media_library core/modules/media_library/src/OpenerResolverInterface.php Defines an interface to get a media library opener from the container. 1 3
OpenModalDialogCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/OpenModalDialogCommand.php Defines an AJAX command to open certain content in a dialog in a modal dialog. 5
OpenModalDialogWithUrl class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/OpenModalDialogWithUrl.php Provides an AJAX command for opening a modal with URL. 2
OpenOffCanvasDialogCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/OpenOffCanvasDialogCommand.php Defines an AJAX command to open content in a dialog in an off-canvas tray. 2
OpenOffCanvasDialogCommandTest class Drupal\Tests\Core\Ajax core/tests/Drupal/Tests/Core/Ajax/OpenOffCanvasDialogCommandTest.php @coversDefaultClass \Drupal\Core\Ajax\OpenOffCanvasDialogCommand[[api-linebreak]] @group Ajax
OpenTelemetryAuthenticatedPerformanceTest class Drupal\Tests\demo_umami\FunctionalJavascript core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php Tests demo_umami profile performance.
OpenTelemetryFrontPagePerformanceTest class Drupal\Tests\demo_umami\FunctionalJavascript core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryFrontPagePerformanceTest.php Tests demo_umami profile performance.
OpenTelemetryNodePagePerformanceTest class Drupal\Tests\demo_umami\FunctionalJavascript core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryNodePagePerformanceTest.php Tests demo_umami profile performance.
OperationBase abstract class Drupal\image_test\Plugin\ImageToolkit\Operation\test core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/OperationBase.php Provides a base class for test operations. 4
OperationData class Drupal\Composer\Plugin\Scaffold\Operations composer/Plugin/Scaffold/Operations/OperationData.php Holds parameter data for operation objects during operation creation only. 1
OperationFactory class Drupal\Composer\Plugin\Scaffold\Operations composer/Plugin/Scaffold/Operations/OperationFactory.php Create Scaffold operation objects based on provided metadata. 1
OperationInterface interface Drupal\Composer\Plugin\Scaffold\Operations composer/Plugin/Scaffold/Operations/OperationInterface.php Interface for scaffold operation objects. 1 1
Operations class Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/Operations.php Provides a render element for a set of operations links.
Opml class Drupal\views\Plugin\views\style core/modules/views/src/Plugin/views/style/Opml.php Default style plugin to render an OPML feed.
OpmlFields class Drupal\views\Plugin\views\row core/modules/views/src/Plugin/views/row/OpmlFields.php Renders an OPML item based on fields.
OptGroup class Drupal\Core\Form core/lib/Drupal/Core/Form/OptGroup.php Provides helpers for HTML option groups. 6
OptGroupTest class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/OptGroupTest.php @coversDefaultClass \Drupal\Core\Form\OptGroup[[api-linebreak]] @group Form
OptimizedPhpArrayDumper class Drupal\Component\DependencyInjection\Dumper core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php OptimizedPhpArrayDumper dumps a service container as a serialized PHP array. 1
OptimizedPhpArrayDumperTest class Drupal\Tests\Component\DependencyInjection\Dumper core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php @coversDefaultClass \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper[[api-linebreak]] @group DependencyInjection 1
OptionalContextCondition class Drupal\condition_test\Plugin\Condition core/modules/system/tests/modules/condition_test/src/Plugin/Condition/OptionalContextCondition.php Provides a condition with an optional node context.
OptionalContextConditionTest class Drupal\KernelTests\Core\Plugin\Condition core/tests/Drupal/KernelTests/Core/Plugin/Condition/OptionalContextConditionTest.php Tests a condition with optional context.
OptionsButtonsWidget class Drupal\Core\Field\Plugin\Field\FieldWidget core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsButtonsWidget.php Plugin implementation of the 'options_buttons' widget.
OptionsDefaultFormatter class Drupal\options\Plugin\Field\FieldFormatter core/modules/options/src/Plugin/Field/FieldFormatter/OptionsDefaultFormatter.php Plugin implementation of the 'list_default' formatter.
OptionsDynamicValuesApiTest class Drupal\Tests\options\Kernel core/modules/options/tests/src/Kernel/OptionsDynamicValuesApiTest.php Tests the options allowed values api.
OptionsDynamicValuesTestBase abstract class Drupal\Tests\options\Functional core/modules/options/tests/src/Functional/OptionsDynamicValuesTestBase.php Base class for testing allowed values of options fields. 1
OptionsDynamicValuesValidationTest class Drupal\Tests\options\Kernel core/modules/options/tests/src/Kernel/OptionsDynamicValuesValidationTest.php Tests the Options field allowed values function.
OptionsField class Drupal\options\Plugin\migrate\field\d7 core/modules/options/src/Plugin/migrate/field/d7/OptionsField.php #[MigrateField(id: 'options', core: [ 7, ], source_module: 'options', destination_module: 'options')]
OptionsFieldTest class Drupal\Tests\options\Kernel core/modules/options/tests/src/Kernel/OptionsFieldTest.php Tests for the 'Options' field types.

Other projects


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