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
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 Tests Drupal\Core\Form\OptGroup.
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 1
OptimizedPhpArrayDumperTest class Drupal\Tests\Component\DependencyInjection\Dumper core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php Tests Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper. 1
OptionalConstraint class Drupal\Core\Validation\Plugin\Validation\Constraint core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/OptionalConstraint.php Marks a field as optional in a Collection constraint.
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.
OptionalServiceSystemTestController class Drupal\system_test\Controller core/modules/system/tests/modules/system_test/src/Controller/OptionalServiceSystemTestController.php A controller that specifies an optional dependency. 1
OptionsAllowedValues class Drupal\options_test core/modules/options/tests/options_test/src/OptionsAllowedValues.php Provide allowed values callback.
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.
OptionsEnumTrait trait Drupal\Core\Utility core/lib/Drupal/Core/Utility/OptionsEnumTrait.php Helper functions to translate enum cases into an array of options. 5
OptionsField class Drupal\options\Plugin\migrate\field\d7 core/modules/options/src/Plugin/migrate/field/d7/OptionsField.php Migrate field plugin for Drupal 7 options fields.
OptionsFieldTest class Drupal\Tests\options\Kernel core/modules/options/tests/src/Kernel/OptionsFieldTest.php Tests for the 'Options' field types.
OptionsFieldUIAllowedValuesTest class Drupal\Tests\options\FunctionalJavascript core/modules/options/tests/src/FunctionalJavascript/OptionsFieldUIAllowedValuesTest.php Tests the Options field allowed values UI functionality.
OptionsFieldUITest class Drupal\Tests\options\FunctionalJavascript core/modules/options/tests/src/FunctionalJavascript/OptionsFieldUITest.php Tests the Options field UI functionality.
OptionsFieldUITest class Drupal\Tests\options\Functional core/modules/options/tests/src/Functional/OptionsFieldUITest.php Tests the Options field UI functionality.
OptionsFieldUnitTestBase abstract class Drupal\Tests\options\Kernel core/modules/options/tests/src/Kernel/OptionsFieldUnitTestBase.php Base class for Options module integration tests. 5
OptionsFloatFieldImportTest class Drupal\Tests\options\Functional core/modules/options/tests/src/Functional/OptionsFloatFieldImportTest.php Tests option fields can be updated and created by config synchronization.
OptionsFormattersTest class Drupal\Tests\options\Kernel core/modules/options/tests/src/Kernel/OptionsFormattersTest.php Tests the Options field type formatters.
OptionsHooks class Drupal\options\Hook core/modules/options/src/Hook/OptionsHooks.php Hook implementations for options.
OptionsKeyFormatter class Drupal\options\Plugin\Field\FieldFormatter core/modules/options/src/Plugin/Field/FieldFormatter/OptionsKeyFormatter.php Plugin implementation of the 'list_key' formatter.
OptionsListArgumentTest class Drupal\Tests\options\Kernel\Views core/modules/options/tests/src/Kernel/Views/OptionsListArgumentTest.php Tests options list argument for views.
OptionsListFilterTest class Drupal\Tests\options\Kernel\Views core/modules/options/tests/src/Kernel/Views/OptionsListFilterTest.php Tests options list filter for views.
OptionsProviderInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/OptionsProviderInterface.php Interface for retrieving all possible and settable values. 5 9
OptionsRequestSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/OptionsRequestSubscriber.php Handles options requests. 1 2
OptionsRequestSubscriberTest class Drupal\Tests\Core\EventSubscriber core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php Tests Drupal\Core\EventSubscriber\OptionsRequestSubscriber.
OptionsSelectDynamicValuesTest class Drupal\Tests\options\Functional core/modules/options/tests/src/Functional/OptionsSelectDynamicValuesTest.php Tests an options select with a dynamic allowed values function.
OptionsSelectNoMultipleWidget class Drupal\options_test\Plugin\Field\FieldWidget core/modules/options/tests/options_test/src/Plugin/Field/FieldWidget/OptionsSelectNoMultipleWidget.php Widget extending OptionsSelectWidget without declaring multiple_values.
OptionsSelectWidget class Drupal\Core\Field\Plugin\Field\FieldWidget core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsSelectWidget.php Plugin implementation of the 'options_select' widget. 2 2
OptionsTestBase abstract class Drupal\Tests\options\Kernel\Views core/modules/options/tests/src/Kernel/Views/OptionsTestBase.php Base class for options views tests. 3
OptionsTestHooks class Drupal\options_test\Hook core/modules/options/tests/options_test/src/Hook/OptionsTestHooks.php Hook implementations for options_test.
OptionsViewsHooks class Drupal\options\Hook core/modules/options/src/Hook/OptionsViewsHooks.php Hook implementations for options.
OptionsWidgetBase abstract class Drupal\Core\Field\Plugin\Field\FieldWidget core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsWidgetBase.php Base class for the 'options_*' widgets. 2 1
OptionsWidgetBaseTest class Drupal\Tests\options\Kernel core/modules/options/tests/src/Kernel/OptionsWidgetBaseTest.php Tests OptionsWidgetBase.
OptionsWidgetsTest class Drupal\Tests\options\Functional core/modules/options/tests/src/Functional/OptionsWidgetsTest.php Tests the Options widgets.
OptionWidgetsField class Drupal\options\Plugin\migrate\field\d6 core/modules/options/src/Plugin/migrate/field/d6/OptionWidgetsField.php MigrateField Plugin for Drupal 6 options fields.
Orange class Drupal\plugin_test\Plugin\plugin_test\fruit core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/fruit/Orange.php Plugin annotation @Plugin( id = "orange", label = "Orange", color = "orange" )
OrderAfter class Drupal\Core\Hook\Order core/lib/Drupal/Core/Hook/Order/OrderAfter.php Set this implementation to be after others. 9
OrderBefore class Drupal\Core\Hook\Order core/lib/Drupal/Core/Hook/Order/OrderBefore.php Set this implementation to be before others. 3
OrderByTest class Drupal\Tests\Core\Database core/tests/Drupal/Tests/Core/Database/OrderByTest.php Tests the orderBy() method of select queries.
OrderInterface interface Drupal\Core\Hook\Order core/lib/Drupal/Core/Hook/Order/OrderInterface.php Interface for order specifiers used in hook attributes. 1 2
OrderOperation abstract class Drupal\Core\Hook\OrderOperation core/lib/Drupal/Core/Hook/OrderOperation/OrderOperation.php Base class for order operations. 2 5
OriginatorSubscriber class Drupal\Core\Mailer\EventSubscriber core/lib/Drupal/Core/Mailer/EventSubscriber/OriginatorSubscriber.php Message subscriber which sets the from and sender headers. 1
OriginatorSubscriberTest class Drupal\Tests\mailer\Kernel core/modules/mailer/tests/src/Kernel/OriginatorSubscriberTest.php Tests default originator subscriber.
OtherModuleInstalledHooks class Drupal\respond_install_uninstall_hook_test\Hook core/modules/system/tests/modules/respond_install_uninstall_hook_test/src/Hook/OtherModuleInstalledHooks.php Hook implementations for respond_install_uninstall_hook_test.
OtherModuleUninstalledHooks class Drupal\respond_install_uninstall_hook_test\Hook core/modules/system/tests/modules/respond_install_uninstall_hook_test/src/Hook/OtherModuleUninstalledHooks.php Hook implementations for respond_install_uninstall_hook_test.

Other projects


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