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
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 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.
ExtensionMimeTypeGuesserDeprecationTest class Drupal\KernelTests\Core\File core/tests/Drupal/KernelTests/Core/File/ExtensionMimeTypeGuesserDeprecationTest.php Tests that deprecation messages are raised for deprecations.
ExtensionMimeTypeGuesserLegacyTest class Drupal\KernelTests\Core\File\MimeType core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php Tests filename mimetype detection.
ExtensionMimeTypeGuesserTest class Drupal\KernelTests\Core\File\MimeType core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserTest.php Tests filename mimetype detection.
ExtensionNameConstraint class Drupal\Core\Extension\Plugin\Validation\Constraint core/lib/Drupal/Core/Extension/Plugin/Validation/Constraint/ExtensionNameConstraint.php Checks that the value is a valid extension name. 1
ExtensionNameConstraintTest class Drupal\KernelTests\Core\Extension core/tests/Drupal/KernelTests/Core/Extension/ExtensionNameConstraintTest.php Tests the ExtensionName constraint.
ExtensionNameLengthException class Drupal\Core\Extension core/lib/Drupal/Core/Extension/ExtensionNameLengthException.php Exception thrown when the extension's name length exceeds the maximum. 2
ExtensionNameReservedException class Drupal\Core\Extension core/lib/Drupal/Core/Extension/ExtensionNameReservedException.php Exception thrown when the extension's name is already reserved. 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.
ExtensionStreamBase abstract class Drupal\Core\StreamWrapper core/lib/Drupal/Core/StreamWrapper/ExtensionStreamBase.php Defines a base stream wrapper implementation for extension assets. 2 1
ExtensionStreamTest class Drupal\KernelTests\Core\StreamWrapper core/tests/Drupal/KernelTests/Core/StreamWrapper/ExtensionStreamTest.php Tests extension stream wrappers.
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. 6
ExtensionVersionTest class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ExtensionVersionTest.php Tests 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.
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
ExtractorTest class Drupal\Tests\Core\Theme\Icon\Plugin core/tests/Drupal/Tests/Core/Theme/Icon/Plugin/ExtractorTest.php Tests icon extractor with base and finder base plugin.
ExtractTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/ExtractTest.php Tests Drupal\migrate\Plugin\migrate\process\Extract.
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
ExtraFieldBlockCacheTagInvalidator class Drupal\layout_builder\Cache core/modules/layout_builder/src/Cache/ExtraFieldBlockCacheTagInvalidator.php Provides a cache tag invalidator that clears the block cache. 2
ExtraFieldBlockDeriver class Drupal\layout_builder\Plugin\Derivative core/modules/layout_builder/src/Plugin/Derivative/ExtraFieldBlockDeriver.php Provides entity field block definitions for every field. 1
FactoryInterface interface Drupal\Component\Plugin\Factory core/lib/Drupal/Component/Plugin/Factory/FactoryInterface.php Factory interface implemented by all plugin factories. 2 6
FactoryTest class Drupal\KernelTests\Core\Plugin core/tests/Drupal/KernelTests/Core/Plugin/FactoryTest.php Tests that plugins are correctly instantiated.
Failing class Drupal\image_test\Plugin\ImageToolkit\Operation\test core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/Operation/test/Failing.php An image toolkit operation that throws a \RuntimeException.
FailureMarker final class Drupal\package_manager core/modules/package_manager/src/FailureMarker.php Handles failure marker file operation. 8
FailureMarkerExistsException final class Drupal\package_manager\Exception core/modules/package_manager/src/Exception/FailureMarkerExistsException.php Exception thrown if a stage can't be created due to an earlier failed commit. 5
FailureMarkerRequirementTest class Drupal\Tests\package_manager\Functional core/modules/package_manager/tests/src/Functional/FailureMarkerRequirementTest.php Tests that Package Manager's requirements check for the failure marker.
FailureMarkerTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/FailureMarkerTest.php Tests Drupal\package_manager\FailureMarker.
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
FakeRecord class Drupal\Tests\system\Functional\Database core/modules/system/tests/src/Functional/Database/FakeRecord.php Fetches into a class. 2
FakeSiteFixtureTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/FakeSiteFixtureTest.php Test that the 'fake-site' fixture is a valid starting point.
FakeViewModeContext class Drupal\layout_builder_field_block_test\ContextProvider core/modules/layout_builder/tests/modules/layout_builder_field_block_test/src/ContextProvider/FakeViewModeContext.php Provides a global context for view_mode for testing purposes. 2
FallbackFieldTypeCategory class Drupal\Core\Field core/lib/Drupal/Core/Field/FallbackFieldTypeCategory.php Fallback plugin class for FieldTypeCategoryManager. 1 1
FallbackPluginManagerInterface interface Drupal\Component\Plugin core/lib/Drupal/Component/Plugin/FallbackPluginManagerInterface.php An interface implemented by plugin managers with fallback plugin behaviors. 6 8
FalseContentResponse class Drupal\Tests\Core\StackMiddleware core/tests/Drupal/Tests/Core/StackMiddleware/ContentLengthTest.php Response that returns FALSE from ::getContent().
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.
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\views\Plugin\views\display core/modules/views/src/Plugin/views/display/Feed.php The plugin that handles a feed, such as RSS or atom.
FetchModeTrait trait Drupal\Core\Database core/lib/Drupal/Core/Database/FetchModeTrait.php Provide helper methods for statement fetching. 4
FetchTest class Drupal\KernelTests\Core\Database core/tests/Drupal/KernelTests/Core/Database/FetchTest.php Tests the Database system's various fetch capabilities.
FiberPlaceholderTest class Drupal\Tests\big_pipe\Unit\Render core/modules/big_pipe/tests/src/Unit/Render/FiberPlaceholderTest.php Tests Drupal\big_pipe\Render\BigPipe.
FibersTestExtension class Drupal\twig_fibers_test\TwigExtension core/modules/system/tests/modules/twig_fibers_test/src/TwigExtension/FibersTestExtension.php Custom Twig extension that suspends a fiber. 2

Other projects


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