Classes, traits, and interfaces - 9.5.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 1523

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
ExposedFormRenderTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/ExposedFormRenderTest.php Tests the exposed form.
ExposedFormTest class Drupal\Tests\views\Functional\Plugin core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php Tests exposed forms functionality.
ExposedFormUITest class Drupal\Tests\views_ui\Functional core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php Tests exposed forms UI functionality.
ExtendableInterface interface Drupal\Core\Database\Query core/lib/Drupal/Core/Database/Query/ExtendableInterface.php Interface for extendable query objects. 1
ExtendingNonInstalledClass class Drupal\plugin_test\Plugin\plugin_test\fruit core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/fruit/ExtendingNonInstalledClass.php Plugin annotation @Plugin( id = "extending_non_installed_class", label = "A plugin whose class is extending from a non-installed module class", color = "pink", )
Extension class Drupal\system\Plugin\migrate\source core/modules/system/src/Plugin/migrate/source/Extension.php Drupal 6/7 system data for a legacy extension source from database.
Extension class Drupal\Core\Extension core/lib/Drupal/Core/Extension/Extension.php Defines an extension (file) object. 43
ExtensionDiscovery class Drupal\Core\Extension core/lib/Drupal/Core/Extension/ExtensionDiscovery.php Discovers available extensions in the filesystem. 24
ExtensionDiscoveryTest class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ExtensionDiscoveryTest.php Tests discovery of extensions.
ExtensionInstallStorage class Drupal\Core\Config core/lib/Drupal/Core/Config/ExtensionInstallStorage.php Storage to access configuration and schema in enabled extensions. 2 2
ExtensionInstallStorageTest class Drupal\Tests\Core\Config core/tests/Drupal/Tests/Core/Config/ExtensionInstallStorageTest.php @coversDefaultClass \Drupal\Core\Config\ExtensionInstallStorage @group Config
ExtensionLifecycle final class Drupal\Core\Extension core/lib/Drupal/Core/Extension/ExtensionLifecycle.php Extension lifecycle. 20
ExtensionList abstract class Drupal\Core\Extension core/lib/Drupal/Core/Extension/ExtensionList.php Provides available extensions. 5 2
ExtensionListTest class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php @coversDefaultClass \Drupal\Core\Extension\ExtensionList @group Extension
ExtensionListTestTrait trait Drupal\Tests core/tests/Drupal/Tests/ExtensionListTestTrait.php Provides extension list methods. 2
ExtensionListTrait trait Drupal\Core\Installer core/lib/Drupal/Core/Installer/ExtensionListTrait.php Provides common functionality for the extension list classes.
ExtensionMimeTypeGuesser class Drupal\Core\File\MimeType core/lib/Drupal/Core/File/MimeType/ExtensionMimeTypeGuesser.php Makes possible to guess the MIME type of a file using its extension. 2
ExtensionMimeTypeGuesser class Drupal\Core\ProxyClass\File\MimeType core/lib/Drupal/Core/ProxyClass/File/MimeType/ExtensionMimeTypeGuesser.php Provides a proxy class for \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser.
ExtensionNameLengthException class Drupal\Core\Extension core/lib/Drupal/Core/Extension/ExtensionNameLengthException.php Exception thrown when the extension's name length exceeds the allowed maximum. 2
ExtensionPathResolver class Drupal\Core\Extension core/lib/Drupal/Core/Extension/ExtensionPathResolver.php Factory for getting extension lists by type. 5 2
ExtensionPathResolverTest class Drupal\KernelTests\Core\Bootstrap core/tests/Drupal/KernelTests/Core/Bootstrap/ExtensionPathResolverTest.php Tests that extension path resolver works correctly.
ExtensionSerializationTest class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ExtensionSerializationTest.php Tests Extension serialization.
ExtensionTest class Drupal\Tests\system\Kernel\Plugin\migrate\source core/modules/system/tests/src/Kernel/Plugin/migrate/source/ExtensionTest.php Tests legacy extension source plugin.
ExtensionVersion final class Drupal\Core\Extension core/lib/Drupal/Core/Extension/ExtensionVersion.php Provides an extension version value object. 5
ExtensionVersionTest class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ExtensionVersionTest.php @coversDefaultClass \Drupal\Core\Extension\ExtensionVersion
ExtensionViewsFieldTest class Drupal\Tests\file\Kernel\Views core/modules/file/tests/src/Kernel/Views/ExtensionViewsFieldTest.php Tests the core Drupal\file\Plugin\views\field\Extension handler.
ExternalCommandRequirementsTrait trait Drupal\BuildTests\Framework core/tests/Drupal/BuildTests/Framework/ExternalCommandRequirementsTrait.php Allows test classes to require external command line applications. 1
ExternalCommandRequirementTest class Drupal\BuildTests\Framework\Tests core/tests/Drupal/BuildTests/Framework/Tests/ExternalCommandRequirementTest.php @coversDefaultClass \Drupal\BuildTests\Framework\ExternalCommandRequirementsTrait @group Build
ExternalFormUrlTest class Drupal\KernelTests\Core\Form core/tests/Drupal/KernelTests/Core/Form/ExternalFormUrlTest.php Ensures that form actions can't be tricked into sending to external URLs.
ExternalNormalizersTest class Drupal\Tests\jsonapi\Functional core/modules/jsonapi/tests/src/Functional/ExternalNormalizersTest.php Asserts external normalizers are handled as expected by the JSON:API module.
Extract class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/Extract.php Extracts a value from an array. 1
ExtractTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/ExtractTest.php @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\Extract @group migrate
ExtractTest class Drupal\Tests\migrate\Kernel\process core/modules/migrate/tests/src/Kernel/process/ExtractTest.php Tests the extract process plugin.
ExtraFieldBlock class Drupal\layout_builder\Plugin\Block core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php Provides a block that renders an extra field from an entity. 1
ExtraFieldBlockDeriver class Drupal\layout_builder\Plugin\Derivative core/modules/layout_builder/src/Plugin/Derivative/ExtraFieldBlockDeriver.php Provides entity field block definitions for every field.
FactoryInterface interface Drupal\Component\Plugin\Factory core/lib/Drupal/Component/Plugin/Factory/FactoryInterface.php Factory interface implemented by all plugin factories. 2 3
FactoryTest class Drupal\KernelTests\Core\Plugin core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php Tests that plugins are correctly instantiated.
FakeAbstractProxy class Drupal\Tests\Core\Session core/tests/Drupal/Tests/Core/Session/SessionManagerTest.php
FakeAutoloader class Drupal\Tests\Core\DrupalKernel core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php A fake autoloader for testing.
FakeLogEntries trait Drupal\Tests\dblog\Functional core/modules/dblog/tests/src/Functional/FakeLogEntries.php Provides methods to generate log entries. 1
FakePhpassHashedPassword class Drupal\Tests\Core\Password core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php A fake class for tests.
FakeRecord class Drupal\Tests\system\Functional\Database core/modules/system/tests/src/Functional/Database/FakeRecord.php Fetches into a class. 2
FakeTemplateWrapper class Drupal\Tests\help_topics\Unit core/modules/help_topics/tests/src/Unit/HelpTopicTwigTest.php Defines a fake template class to mock \Twig\TemplateWrapper.
FakeViewModeContext class Drupal\layout_builder_fieldblock_test\ContextProvider core/modules/layout_builder/tests/modules/layout_builder_fieldblock_test/src/ContextProvider/FakeViewModeContext.php Provides a global context for view_mode for testing purposes. 2
FallbackPluginManagerInterface interface Drupal\Component\Plugin core/lib/Drupal/Component/Plugin/FallbackPluginManagerInterface.php An interface implemented by plugin managers with fallback plugin behaviors. 5 5
Fast404ExceptionHtmlSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php High-performance 404 exception subscriber. 2
Fast404Test class Drupal\FunctionalTests\EventSubscriber core/tests/Drupal/FunctionalTests/EventSubscriber/Fast404Test.php Tests the fast 404 functionality.
FastTest class Drupal\Tests\system\Functional\Theme core/modules/system/tests/src/Functional/Theme/FastTest.php Tests autocompletion not loading registry.
FavoriteAnimalTestForm class Drupal\block_test\Form core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php Form that performs favorite animal test.
Feed class Drupal\aggregator\Entity core/modules/aggregator/src/Entity/Feed.php Defines the aggregator feed entity class. 19

Other projects


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