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
MoveTest class Drupal\Tests\file\Kernel core/modules/file/tests/src/Kernel/MoveTest.php Tests the file move function.
MTimeProtectedFastFileStorage class Drupal\Component\PhpStorage core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php Stores PHP code in files with securely hashed names. 1
MTimeProtectedFastFileStorageTest class Drupal\Tests\Component\PhpStorage core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFastFileStorageTest.php Tests the MTimeProtectedFastFileStorage implementation.
MTimeProtectedFileStorage class Drupal\Component\PhpStorage core/lib/Drupal/Component/PhpStorage/MTimeProtectedFileStorage.php Stores PHP code in files with securely hashed names. 1
MTimeProtectedFileStorageBase abstract class Drupal\Tests\Component\PhpStorage core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageBase.php Base test class for MTime protected storage. 2
MTimeProtectedFileStorageTest class Drupal\Tests\Component\PhpStorage core/tests/Drupal/Tests/Component/PhpStorage/MTimeProtectedFileStorageTest.php Tests the MTimeProtectedFileStorage implementation.
MultiFormTest class Drupal\FunctionalJavascriptTests\Ajax core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php Tests AJAX-enabled forms when multiple instances of the form are on a page.
MultiItemsFieldHandlerInterface interface Drupal\views\Plugin\views\field core/modules/views/src/Plugin/views/field/MultiItemsFieldHandlerInterface.php Defines a field handler which renders multiple items per row. 2
MultilingualReviewPageTest class Drupal\Tests\migrate_drupal_ui\Functional\d6 core/modules/migrate_drupal_ui/tests/src/Functional/d6/MultilingualReviewPageTest.php Tests migrate upgrade review page for Drupal 6.
MultilingualReviewPageTest class Drupal\Tests\migrate_drupal_ui\Functional\d7 core/modules/migrate_drupal_ui/tests/src/Functional/d7/MultilingualReviewPageTest.php Tests migrate upgrade review page for Drupal 7.
MultilingualReviewPageTest class Drupal\Tests\aggregator\Functional\migrate_drupal_ui\d6 core/modules/aggregator/tests/src/Functional/migrate_drupal_ui/d6/MultilingualReviewPageTest.php Tests migrate upgrade review page for Drupal 6 for the aggregator module.
MultilingualReviewPageTest class Drupal\Tests\aggregator\Functional\migrate_drupal_ui\d7 core/modules/aggregator/tests/src/Functional/migrate_drupal_ui/d7/MultilingualReviewPageTest.php Tests migrate upgrade review page for Drupal 7 for the aggregator module.
MultilingualReviewPageTestBase abstract class Drupal\Tests\migrate_drupal_ui\Functional core/modules/migrate_drupal_ui/tests/src/Functional/MultilingualReviewPageTestBase.php Provides a base class for testing the review step of the Upgrade form. 5 4
MultipleBlockFormTest class Drupal\KernelTests\Core\Block core/tests/Drupal/KernelTests/Core/Block/MultipleBlockFormTest.php Tests that blocks can have multiple forms.
MultipleDistributionsProfileTest class Drupal\FunctionalTests\Installer core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php Tests multiple distribution profile support.
MultipleFileUploadTest class Drupal\Tests\file\Functional core/modules/file/tests/src/Functional/MultipleFileUploadTest.php Tests multiple file upload.
MultipleProviderAnnotationInterface interface Drupal\migrate\Annotation core/modules/migrate/src/Annotation/MultipleProviderAnnotationInterface.php Defines a common interface for classed annotations with multiple providers. 1 1
MultipleStaticContext class Drupal\block_test\ContextProvider core/modules/block/tests/modules/block_test/src/ContextProvider/MultipleStaticContext.php Sets multiple contexts for a static value. 2
MultiStepNodeFormBasicOptionsTest class Drupal\Tests\node\Functional core/modules/node/tests/src/Functional/MultiStepNodeFormBasicOptionsTest.php Tests the persistence of basic options through multiple steps.
MultiValueTestItem class Drupal\entity_test_update\Plugin\Field\FieldType core/modules/system/tests/modules/entity_test_update/src/Plugin/Field/FieldType/MultiValueTestItem.php Defines the 'multi_value_test' field type.
MultiWidthLayoutBase abstract class Drupal\layout_builder\Plugin\Layout core/modules/layout_builder/src/Plugin/Layout/MultiWidthLayoutBase.php Base class of layouts with configurable widths. 2
Mysql8RequirePrimaryKeyUpdateTest class Drupal\Tests\user\Functional core/modules/user/tests/src/Functional/Mysql8RequirePrimaryKeyUpdateTest.php Tests user_update_9301() on MySQL 8 when sql_require_primary_key is on.
MysqlDateSql class Drupal\views\Plugin\views\query core/modules/views/src/Plugin/views/query/MysqlDateSql.php MySQL-specific date handling. 1 2
MysqlDateSqlTest class Drupal\Tests\views\Unit\Plugin\views\query core/modules/views/tests/src/Unit/Plugin/views/query/MysqlDateSqlTest.php Tests the MySQL-specific date query handler.
MysqlDriverLegacyTest class Drupal\Tests\mysql\Kernel\mysql core/modules/mysql/tests/src/Kernel/mysql/MysqlDriverLegacyTest.php Tests the deprecations of the MySQL database driver classes in Core.
Name class Drupal\user\Plugin\views\filter core/modules/user/src/Plugin/views/filter/Name.php Filter handler for usernames. 2 2
Name class Drupal\Tests\Component\Annotation\Doctrine core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
NameMungingTest class Drupal\KernelTests\Core\File core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php Tests filename munging and unmunging.
NaughtyRecursiveLogger class Drupal\Tests\Core\Logger core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php
NegotiationBrowserDeleteForm class Drupal\language\Form core/modules/language/src/Form/NegotiationBrowserDeleteForm.php Defines a confirmation form for deleting a browser language negotiation mapping. 1
NegotiationBrowserForm class Drupal\language\Form core/modules/language/src/Form/NegotiationBrowserForm.php Configure the browser language negotiation method for this site. 1
NegotiationConfigureForm class Drupal\language\Form core/modules/language/src/Form/NegotiationConfigureForm.php Configure the selected language negotiation method for this site. 1
NegotiationMiddleware class Drupal\Core\StackMiddleware core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php Provides a middleware to determine the content type upon the accept header. 1 3 2
NegotiationMiddlewareTest class Drupal\Tests\Core\StackMiddleware core/tests/Drupal/Tests/Core/StackMiddleware/NegotiationMiddlewareTest.php @coversDefaultClass \Drupal\Core\StackMiddleware\NegotiationMiddleware[[api-linebreak]] @group NegotiationMiddleware
NegotiationSelectedForm class Drupal\language\Form core/modules/language/src/Form/NegotiationSelectedForm.php Configure the selected language negotiation method for this site. 1
NegotiationSessionForm class Drupal\language\Form core/modules/language/src/Form/NegotiationSessionForm.php Configure the session language negotiation method for this site. 1
NegotiationUrlForm class Drupal\language\Form core/modules/language/src/Form/NegotiationUrlForm.php Configure the URL language negotiation method for this site. 1
NegotiatorBase abstract class Drupal\jsonapi\Revisions core/modules/jsonapi/src/Revisions/NegotiatorBase.php Base implementation for version negotiators. 2
NestedArray class Drupal\Component\Utility core/lib/Drupal/Component/Utility/NestedArray.php Provides helpers to perform operations on nested arrays and array keys of variable depth. 110
NestedArrayTest class Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php @coversDefaultClass \Drupal\Component\Utility\NestedArray[[api-linebreak]] @group Utility
NestedEntityTestForm class Drupal\field_test\Form core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php Provides a form for field_test routes. 1
NestedFormTest class Drupal\Tests\field\Functional core/modules/field/tests/src/Functional/NestedFormTest.php Tests field elements in nested forms.
NestedTableDragTestForm class Drupal\tabledrag_test\Form core/modules/system/tests/modules/tabledrag_test/src/Form/NestedTableDragTestForm.php Provides a form for testing nested draggable tables. 1
NewDefaultThemeBlocksTest class Drupal\Tests\block\Kernel core/modules/block/tests/src/Kernel/NewDefaultThemeBlocksTest.php Tests that a new default theme gets blocks.
NewMimeTypeGuesser class Drupal\Tests\Core\DependencyInjection\Compiler core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/MimeTypePassTest.php
NewService class Drupal\new_dependency_test_with_service core/modules/system/tests/modules/new_dependency_test_with_service/src/NewService.php Generic service returning a greeting. 2 2
NewTopicsBlock class Drupal\forum\Plugin\Block core/modules/forum/src/Plugin/Block/NewTopicsBlock.php Provides a 'New forum topics' block.
NewViewAggregatorConfigSchemaTest class Drupal\Tests\aggregator\Functional\views_ui core/modules/aggregator/tests/src/Functional/views_ui/NewViewAggregatorConfigSchemaTest.php Tests aggregator configuration schema against new views.
NewViewConfigSchemaTest class Drupal\Tests\views_ui\Functional core/modules/views_ui/tests/src/Functional/NewViewConfigSchemaTest.php Tests configuration schema against new views.
NextIdTest class Drupal\KernelTests\Core\Database core/tests/Drupal/KernelTests/Core/Database/NextIdTest.php Tests the sequences API.

Other projects


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