Classes, traits, and interfaces - 8.9.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 1511

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
DCOM58Test class Drupal\Tests\Component\Annotation\Doctrine\Ticket core/tests/Drupal/Tests/Component/Annotation/Doctrine/Ticket/DCOM58Test.php This class is a near-copy of \Doctrine\Tests\Common\Annotations\Ticket\DCOM58Test, which is part of the Doctrine project: <http://www.doctrine-project.org>. It was copied from version 1.2.7.
DecimalFormatter class Drupal\Core\Field\Plugin\Field\FieldFormatter core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/DecimalFormatter.php Plugin implementation of the 'number_decimal' formatter.
DecimalItem class Drupal\Core\Field\Plugin\Field\FieldType core/lib/Drupal/Core/Field/Plugin/Field/FieldType/DecimalItem.php Defines the 'decimal' field type.
DedupeBase

in drupal:8.4.0 and is removed from drupal:9.0.0. Use \Drupal\migrate\Plugin\migrate\process\MakeUniqueBase instead.

abstract class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/DedupeBase.php This abstract base contains the dedupe logic.
DedupeEntity

in drupal:8.4.0 and is removed from drupal:9.0.0. Use \Drupal\migrate\Plugin\migrate\process\MakeUniqueEntityField instead.

class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/DedupeEntity.php Ensures value is not duplicated against an entity field. 1
DedupeEntityTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/DedupeEntityTest.php @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\DedupeEntity @group migrate @group legacy
DefaultAccessCheck class Drupal\Core\Access core/lib/Drupal/Core/Access/DefaultAccessCheck.php Allows access to routes to be controlled by an '_access' boolean parameter. 2 2
DefaultAccessCheckTest class Drupal\Tests\Core\Access core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php @coversDefaultClass \Drupal\Core\Access\DefaultAccessCheck @group Access
DefaultConfigTest class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php Tests default configuration of the Extension system.
DefaultConfigTest class Drupal\KernelTests\Config core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php Tests that the installed config matches the default config.
DefaultConfigTest class Drupal\KernelTests\Core\Config core/tests/Drupal/KernelTests/Core/Config/DefaultConfigTest.php Tests that default configuration provided by all modules matches schema.
DefaultContentFilesAccessTest class Drupal\Tests\demo_umami_content\Functional core/profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/DefaultContentFilesAccessTest.php Tests that files provided by demo_umami_content are not accessible.
DefaultContentModerationStateRevisionUpdateTest class Drupal\Tests\content_moderation\Functional\Update core/modules/content_moderation/tests/src/Functional/Update/DefaultContentModerationStateRevisionUpdateTest.php Test updating the ContentModerationState entity default revisions.
DefaultDisplay class Drupal\views\Plugin\views\display core/modules/views/src/Plugin/views/display/DefaultDisplay.php A plugin to handle defaults on a view. 1
DefaultDisplayExtender class Drupal\views\Plugin\views\display_extender core/modules/views/src/Plugin/views/display_extender/DefaultDisplayExtender.php Default display extender plugin; does nothing.
DefaultExceptionHtmlSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php Exception subscriber for handling core default HTML error pages. 1 2
DefaultExceptionSubscriber class Drupal\jsonapi\EventSubscriber core/modules/jsonapi/src/EventSubscriber/DefaultExceptionSubscriber.php Serializes exceptions in compliance with the JSON:API specification. 2
DefaultExceptionSubscriber class Drupal\serialization\EventSubscriber core/modules/serialization/src/EventSubscriber/DefaultExceptionSubscriber.php Handles default error responses in serialization formats. 1 2 2
DefaultExceptionSubscriberTest class Drupal\Tests\serialization\Unit\EventSubscriber core/modules/serialization/tests/src/Unit/EventSubscriber/DefaultExceptionSubscriberTest.php @coversDefaultClass \Drupal\serialization\EventSubscriber\DefaultExceptionSubscriber @group serialization
DefaultFactory class Drupal\Component\Plugin\Factory core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php Default plugin factory. 2 13
DefaultFactoryTest class Drupal\Tests\Component\Plugin core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php @coversDefaultClass \Drupal\Component\Plugin\Factory\DefaultFactory @group Plugin
DefaultFetcher class Drupal\aggregator\Plugin\aggregator\fetcher core/modules/aggregator/src/Plugin/aggregator/fetcher/DefaultFetcher.php Defines a default fetcher implementation. 1 1
DefaultFileFormatter class Drupal\file\Plugin\Field\FieldFormatter core/modules/file/src/Plugin/Field/FieldFormatter/DefaultFileFormatter.php Formatter for a text field on a file entity that links the field to the file.
DefaultFormatTest class Drupal\FunctionalTests\Routing core/tests/Drupal/FunctionalTests/Routing/DefaultFormatTest.php @group routing
DefaultFormatTestController class Drupal\default_format_test core/modules/system/tests/modules/default_format_test/src/DefaultFormatTestController.php
DefaultHtmlRouteProvider class Drupal\Core\Entity\Routing core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php Provides HTML routes for entities. 2 1
DefaultHtmlRouteProviderTest class Drupal\Tests\Core\Entity\Routing core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php @coversDefaultClass \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider @group Entity
DefaultLangcode class Drupal\language\Plugin\migrate\destination core/modules/language/src/Plugin/migrate/destination/DefaultLangcode.php Provides a destination plugin for the default langcode config.
DefaultLanguageItem class Drupal\language core/modules/language/src/DefaultLanguageItem.php Alternative plugin implementation of the 'language' field type.
DefaultLanguageRenderer class Drupal\views\Entity\Render core/modules/views/src/Entity/Render/DefaultLanguageRenderer.php Renders entities in their default language.
DefaultLazyPluginCollection class Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php Provides a default plugin collection for a plugin type. 6 9
DefaultLazyPluginCollectionTest class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php @coversDefaultClass \Drupal\Core\Plugin\DefaultLazyPluginCollection @group Plugin
DefaultMenuLinkTreeManipulators class Drupal\Core\Menu core/lib/Drupal/Core/Menu/DefaultMenuLinkTreeManipulators.php Provides a couple of menu link tree manipulators. 1 2
DefaultMenuLinkTreeManipulatorsTest class Drupal\Tests\Core\Menu core/tests/Drupal/Tests/Core/Menu/DefaultMenuLinkTreeManipulatorsTest.php Tests the default menu link tree manipulators.
DefaultMetatagsTest class Drupal\Tests\system\Functional\Page core/modules/system/tests/src/Functional/Page/DefaultMetatagsTest.php Tests default HTML metatags on a page.
DefaultMobileMetaTagsTest class Drupal\Tests\system\Functional\System core/modules/system/tests/src/Functional/System/DefaultMobileMetaTagsTest.php Confirm that the default mobile meta tags appear as expected.
DefaultModerationStateTest class Drupal\Tests\content_moderation\Functional core/modules/content_moderation/tests/src/Functional/DefaultModerationStateTest.php Tests setting a custom default moderation state.
DefaultModerationStateUpdateTest class Drupal\Tests\content_moderation\Functional\Update core/modules/content_moderation/tests/src/Functional/Update/DefaultModerationStateUpdateTest.php Tests the upgrade path for updating the 'default_moderation_state' setting.
DefaultNegotiator class Drupal\Core\Theme core/lib/Drupal/Core/Theme/DefaultNegotiator.php Determines the default theme of the site. 2
DefaultParser class Drupal\aggregator\Plugin\aggregator\parser core/modules/aggregator/src/Plugin/aggregator/parser/DefaultParser.php Defines a default parser implementation. 1 1
DefaultPluginManager class Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/DefaultPluginManager.php Base class for plugin managers. 47 47
DefaultPluginManagerTest class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php Tests the DefaultPluginManager.
DefaultProcessor class Drupal\aggregator\Plugin\aggregator\processor core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php Defines a default processor implementation.
DefaultRequestPolicy class Drupal\Core\PageCache core/lib/Drupal/Core/PageCache/DefaultRequestPolicy.php The default page cache request policy. 2
DefaultRequestPolicy class Drupal\dynamic_page_cache\PageCache\RequestPolicy core/modules/dynamic_page_cache/src/PageCache/RequestPolicy/DefaultRequestPolicy.php The default Dynamic Page Cache request policy. 2
DefaultRevisionStateTest class Drupal\Tests\content_moderation\Kernel core/modules/content_moderation/tests/src/Kernel/DefaultRevisionStateTest.php Tests the correct default revision is set.
DefaultSelection class Drupal\Core\Entity\Plugin\EntityReferenceSelection core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php Default plugin implementation of the Entity Reference Selection plugin. 10 8
DefaultSelectionDeriver class Drupal\Core\Entity\Plugin\Derivative core/lib/Drupal/Core/Entity/Plugin/Derivative/DefaultSelectionDeriver.php Provides derivative plugins for the DefaultSelection plugin.
DefaultsEntityForm class Drupal\layout_builder\Form core/modules/layout_builder/src/Form/DefaultsEntityForm.php Provides a form containing the Layout Builder UI for defaults. 1
DefaultSingleLazyPluginCollection class Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php Provides a default plugin collection for a plugin type. 3 7

Other projects


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