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
PreExportEvent final class Drupal\Core\DefaultContent core/lib/Drupal/Core/DefaultContent/PreExportEvent.php Event dispatched before an entity is exported as default content. 7
PrefetchedResult class Drupal\Core\Database\Statement core/lib/Drupal/Core/Database/Statement/PrefetchedResult.php Class for prefetched results of a data query language (DQL) statement. 1
PrefixFloodInterface interface Drupal\Core\Flood core/lib/Drupal/Core/Flood/PrefixFloodInterface.php Defines an interface for flood controllers that clear by identifier prefix. 2 1
PrefixInfoTest class Drupal\Tests\mysqli\Kernel\mysqli core/modules/mysqli/tests/src/Kernel/mysqli/PrefixInfoTest.php Tests that the prefix info for a database schema is correct.
PrefixInfoTest class Drupal\Tests\mysql\Kernel\mysql core/modules/mysql/tests/src/Kernel/mysql/PrefixInfoTest.php Tests that the prefix info for a database schema is correct. 1 1
PreImportEvent final class Drupal\Core\DefaultContent core/lib/Drupal/Core/DefaultContent/PreImportEvent.php Event dispatched before default content is imported. 1
PreloadableRouteProviderInterface interface Drupal\Core\Routing core/lib/Drupal/Core/Routing/PreloadableRouteProviderInterface.php Extends the router provider interface to pre-load routes. 3 3
PrepareCallbackTestForm class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormStateTest.php A test form used for the prepareCallback() tests.
PrepareLayout class Drupal\layout_builder\EventSubscriber core/modules/layout_builder/src/EventSubscriber/PrepareLayout.php An event subscriber to prepare section storage. 2
PrepareLayoutEvent class Drupal\layout_builder\Event core/modules/layout_builder/src/Event/PrepareLayoutEvent.php Event fired in #pre_render of \Drupal\layout_builder\Element\LayoutBuilder. 3
PrepareModulesEntityUninstallForm class Drupal\system\Form core/modules/system/src/Form/PrepareModulesEntityUninstallForm.php Provides a form removing module content entities data before uninstallation. 1
PrepareModulesEntityUninstallFormTest class Drupal\Tests\system\Kernel\Module core/modules/system/tests/src/Kernel/Module/PrepareModulesEntityUninstallFormTest.php Tests PrepareModulesEntityUninstallForm.
PrepareUninstallTest class Drupal\Tests\system\Functional\Module core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php Tests that modules which provide entity types can be uninstalled.
PrependCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/PrependCommand.php AJAX command for calling the jQuery insert() method. 6
PreprocessHooks final class Drupal\admin\Hook core/themes/admin/src/Hook/PreprocessHooks.php Provides preprocess implementations.
PreprocessHooks final class Drupal\default_admin\Hook core/themes/default_admin/src/Hook/PreprocessHooks.php Provides preprocess implementations. 3
PreprocessPagerTest class Drupal\Tests\system\Unit\Pager core/modules/system/tests/src/Unit/Pager/PreprocessPagerTest.php Tests pager preprocessing.
PrerenderList abstract class Drupal\views\Plugin\views\field core/modules/views/src/Plugin/views/field/PrerenderList.php Field handler to provide a list of items. 3 3
PreRequireEvent final class Drupal\package_manager\Event core/modules/package_manager/src/Event/PreRequireEvent.php Event fired before packages are updated to the stage directory. 17
PreventDowngradeTest class Drupal\Tests\system\Functional\UpdateSystem core/modules/system/tests/src/Functional/UpdateSystem/PreventDowngradeTest.php Tests that a site on 11.4.0 is prevented from downgrading to 12.0.0.
PreviewAwareBlock class Drupal\layout_builder_test\Plugin\Block core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Block/PreviewAwareBlock.php Defines a class for a context-aware block.
PreviewAwarePluginInterface interface Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PreviewAwarePluginInterface.php Provides an interface to support preview mode injection in plugins. 2 4
PreviewFallbackInterface interface Drupal\Core\Render core/lib/Drupal/Core/Render/PreviewFallbackInterface.php Allows an element to provide a fallback representation of itself for preview. 1 4
PreviewTest class Drupal\Tests\views_ui\FunctionalJavascript core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php Tests the UI preview functionality.
PreviewTest class Drupal\Tests\views_ui\Functional core/modules/views_ui/tests/src/Functional/PreviewTest.php Tests the UI preview functionality.
PreviewToggleTrait trait Drupal\layout_builder\Form core/modules/layout_builder/src/Form/PreviewToggleTrait.php Provides a trait that provides a toggle for the content preview.
PreWarmableInterface interface Drupal\Core\PreWarm core/lib/Drupal/Core/PreWarm/PreWarmableInterface.php Interface for services with prewarmable caches. 4 6
PreWarmablePluginManagerTrait trait Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PreWarmablePluginManagerTrait.php Provides a trait for Drupal\Core\PreWarm\PreWarmableInterface. 3
PreWarmerTest class Drupal\KernelTests\Core\PreWarm core/tests/Drupal/KernelTests/Core/PreWarm/PreWarmerTest.php Tests the cache prewarmer.
PrimaryKey final class Drupal\Core\Database\SchemaDefinition core/lib/Drupal/Core/Database/SchemaDefinition/PrimaryKey.php Describes a table's primary key. 13
PrimitiveBase abstract class Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/PrimitiveBase.php Base class for primitive data types. 6 6
PrimitiveDataNormalizer class Drupal\serialization\Normalizer core/modules/serialization/src/Normalizer/PrimitiveDataNormalizer.php Converts primitive data objects to their casted values. 2 2
PrimitiveDataNormalizerTest class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/PrimitiveDataNormalizerTest.php Tests Drupal\serialization\Normalizer\PrimitiveDataNormalizer.
PrimitiveInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/PrimitiveInterface.php Interface for primitive data. 8 15
PrimitiveTypeConstraint class Drupal\Core\Validation\Plugin\Validation\Constraint core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraint.php Supports validating all primitive types. 2
PrimitiveTypeConstraintValidator class Drupal\Core\Validation\Plugin\Validation\Constraint core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidator.php Validates the PrimitiveType constraint. 1
PrimitiveTypeConstraintValidatorTest class Drupal\Tests\Core\Validation\Plugin\Validation\Constraint core/tests/Drupal/Tests/Core/Validation/Plugin/Validation/Constraint/PrimitiveTypeConstraintValidatorTest.php Tests Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraintValidator.
PrivateFileOnTranslatedEntityTest class Drupal\Tests\file\Functional core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php Uploads private files to translated node and checks access.
PrivateKey class Drupal\Core core/lib/Drupal/Core/PrivateKey.php Manages the Drupal private key. 9 2
PrivateKeyTest class Drupal\Tests\Core core/tests/Drupal/Tests/Core/PrivateKeyTest.php Tests the PrivateKey class.
PrivateMethodUnitTestTrait trait Drupal\Tests\ckeditor5\Traits core/modules/ckeditor5/tests/src/Traits/PrivateMethodUnitTestTrait.php Provides methods to test protected/private methods in unit tests. 2
PrivateStream class Drupal\Core\StreamWrapper core/lib/Drupal/Core/StreamWrapper/PrivateStream.php Drupal private (private://) stream wrapper class. 4
PrivateTempStore class Drupal\Core\TempStore core/lib/Drupal/Core/TempStore/PrivateTempStore.php Stores and retrieves temporary data for a given owner. 6
PrivateTempStoreFactory class Drupal\Core\TempStore core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php Creates a PrivateTempStore object for a given collection. 12 2
PrivateTempStoreTest class Drupal\Tests\Core\TempStore core/tests/Drupal/Tests/Core/TempStore/PrivateTempStoreTest.php Tests Drupal\Core\TempStore\PrivateTempStore.
ProceduralApiDeprecationTest class Drupal\Tests\Core\Render\Element core/tests/Drupal/Tests/Core/Render/Element/ProceduralApiDeprecationTest.php Tests the deprecation of global rendering functions.
ProceduralCall final class Drupal\Core\Extension core/lib/Drupal/Core/Extension/ProceduralCall.php Helper class to target procedural implementations with hook order attributes. 4
ProceduralHookScanStop class Drupal\Core\Hook\Attribute core/lib/Drupal/Core/Hook/Attribute/ProceduralHookScanStop.php Defines a ProceduralHookScanStop attribute object. 3
ProceduralHookThemeHooks class Drupal\procedural_hook_theme\Hook core/modules/system/tests/themes/HookCollector/procedural_hook_theme/src/Hook/ProceduralHookThemeHooks.php Confirms LegacyHook works with themes.
ProcessedText class Drupal\filter\Element core/modules/filter/src/Element/ProcessedText.php Provides a processed text render element.

Other projects


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