Classes, traits, and interfaces - 10.3.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 1518

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
PoStreamWriter class Drupal\Component\Gettext core/lib/Drupal/Component/Gettext/PoStreamWriter.php Defines a Gettext PO stream writer. 2
PoStreamWriterTest class Drupal\Tests\Component\Gettext core/tests/Drupal/Tests/Component/Gettext/PoStreamWriterTest.php @coversDefaultClass \Drupal\Component\Gettext\PoStreamWriter[[api-linebreak]] @group Gettext
PoWriterInterface interface Drupal\Component\Gettext core/lib/Drupal/Component/Gettext/PoWriterInterface.php Shared interface definition for all Gettext PO Writers. 3 1
PrecedingConstraintAwareValidatorTrait trait Drupal\ckeditor5\Plugin\Validation\Constraint core/modules/ckeditor5/src/Plugin/Validation/Constraint/PrecedingConstraintAwareValidatorTrait.php A constraint may need preceding constraints to not have been violated.
PreconfiguredFieldUiOptionsInterface interface Drupal\Core\Field core/lib/Drupal/Core/Field/PreconfiguredFieldUiOptionsInterface.php Defines an interface for exposing "preconfigured" field definitions. 2 2
PredefinedStatesWorkflowTestType class Drupal\workflow_type_test\Plugin\WorkflowType core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/PredefinedStatesWorkflowTestType.php Test workflow type.
PredefinedWorkflowTypeTest class Drupal\Tests\workflows\Kernel core/modules/workflows/tests/src/Kernel/PredefinedWorkflowTypeTest.php Test a predefined workflow based on something other than configuration.
PreExistingConfigException class Drupal\Core\Config core/lib/Drupal/Core/Config/PreExistingConfigException.php An exception thrown if configuration with the same name already exists. 7
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\mysql\Kernel\mysql core/modules/mysql/tests/src/Kernel/mysql/PrefixInfoTest.php Tests that the prefix info for a database schema is correct.
PreloadableRouteProviderInterface interface Drupal\Core\Routing core/lib/Drupal/Core/Routing/PreloadableRouteProviderInterface.php Extends the router provider interface to pre-load routes. 3 2
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
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
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.
PrimitiveBase abstract class Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/PrimitiveBase.php Base class for primitive data types. 5 5
PrimitiveDataNormalizer class Drupal\serialization\Normalizer core/modules/serialization/src/Normalizer/PrimitiveDataNormalizer.php Converts primitive data objects to their casted values. 1 2
PrimitiveDataNormalizerTest class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/PrimitiveDataNormalizerTest.php @coversDefaultClass \Drupal\serialization\Normalizer\PrimitiveDataNormalizer[[api-linebreak]] @group serialization
PrimitiveInterface interface Drupal\Core\TypedData core/lib/Drupal/Core/TypedData/PrimitiveInterface.php Interface for primitive data. 8 12
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 @coversDefaultClass \Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraintValidator[[api-linebreak]] @group validation
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. 7 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. 5
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 @coversDefaultClass \Drupal\Core\TempStore\PrivateTempStore[[api-linebreak]] @group TempStore
ProcessedText class Drupal\filter\Element core/modules/filter/src/Element/ProcessedText.php Provides a processed text render element.
ProcessField class Drupal\field\Plugin\migrate\process core/modules/field/src/Plugin/migrate/process/ProcessField.php Get the value from a method call on a field plugin instance. 1
ProcessFieldTest class Drupal\Tests\field\Unit\Plugin\migrate\process core/modules/field/tests/src/Unit/Plugin/migrate/process/ProcessFieldTest.php Tests the ProcessField migrate process plugin.
ProcessingTest class Drupal\Tests\system\FunctionalJavascript\Batch core/modules/system/tests/src/FunctionalJavascript/Batch/ProcessingTest.php @group Batch
ProcessingTest class Drupal\Tests\system\Functional\Batch core/modules/system/tests/src/Functional/Batch/ProcessingTest.php Tests batch processing in form and non-form workflow.
ProcessPluginBase class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/ProcessPluginBaseTest.php Extends ProcessPluginBase as a non-abstract class.
ProcessPluginBase abstract class Drupal\migrate core/modules/migrate/src/ProcessPluginBase.php The base class for all migrate process plugins. 76 76
ProcessPluginBaseTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/ProcessPluginBaseTest.php Tests the base process plugin class.
ProfileExtensionList class Drupal\Core\Extension core/lib/Drupal/Core/Extension/ProfileExtensionList.php Provides a list of installation profiles. 7 2

Other projects


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