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
BookRemoveForm class Drupal\book\Form core/modules/book/src/Form/BookRemoveForm.php Remove form for book module. 1
BookSettingsForm class Drupal\book\Form core/modules/book/src/Form/BookSettingsForm.php Configure book settings for this site. 1
BookTest class Drupal\Tests\book\Kernel\Plugin\migrate\source core/modules/book/tests/src/Kernel/Plugin/migrate/source/BookTest.php @covers \Drupal\book\Plugin\migrate\source\Book @group book
BookTest class Drupal\Tests\book\Functional core/modules/book/tests/src/Functional/BookTest.php Create a book, add pages, and test book interface.
BookTestTrait trait Drupal\Tests\book\Functional core/modules/book/tests/src/Functional/BookTestTrait.php Provides common functionality for Book test classes.
BookUninstallTest class Drupal\Tests\book\Kernel core/modules/book/tests/src/Kernel/BookUninstallTest.php Tests that the Book module cannot be uninstalled if books exist.
BookUninstallValidator class Drupal\book\ProxyClass core/modules/book/src/ProxyClass/BookUninstallValidator.php Provides a proxy class for \Drupal\book\BookUninstallValidator.
BookUninstallValidator class Drupal\book core/modules/book/src/BookUninstallValidator.php Prevents book module from being uninstalled under certain conditions. 2
BookUninstallValidatorTest class Drupal\Tests\book\Unit core/modules/book/tests/src/Unit/BookUninstallValidatorTest.php @coversDefaultClass \Drupal\book\BookUninstallValidator @group book
Boolean class Drupal\views\Plugin\views\field core/modules/views/src/Plugin/views/field/Boolean.php A handler to provide proper displays for booleans.
BooleanCheckboxWidget class Drupal\Core\Field\Plugin\Field\FieldWidget core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/BooleanCheckboxWidget.php Plugin implementation of the 'boolean_checkbox' widget.
BooleanData class Drupal\Core\TypedData\Plugin\DataType core/lib/Drupal/Core/TypedData/Plugin/DataType/BooleanData.php The boolean data type. 4 1
BooleanFieldTest class Drupal\Tests\field\Functional\Boolean core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php Tests boolean field functionality.
BooleanFormatter class Drupal\Core\Field\Plugin\Field\FieldFormatter core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/BooleanFormatter.php Plugin implementation of the 'boolean' formatter.
BooleanFormatterSettingsTest class Drupal\Tests\field\FunctionalJavascript\Boolean core/modules/field/tests/src/FunctionalJavascript/Boolean/BooleanFormatterSettingsTest.php Tests the Boolean field formatter settings.
BooleanFormatterSettingsTest class Drupal\Tests\field\Functional\Boolean core/modules/field/tests/src/Functional/Boolean/BooleanFormatterSettingsTest.php Tests the Boolean field formatter settings.
BooleanFormatterTest class Drupal\Tests\field\Kernel\Boolean core/modules/field/tests/src/Kernel/Boolean/BooleanFormatterTest.php Tests the boolean formatter.
BooleanInterface interface Drupal\Core\TypedData\Type core/lib/Drupal/Core/TypedData/Type/BooleanInterface.php Interface for boolean data. 1 4
BooleanItem class Drupal\Core\Field\Plugin\Field\FieldType core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php Defines the 'boolean' entity field type. 1 6
BooleanItemNormalizer class Drupal\test_fieldtype_boolean_emoji_normalizer\Normalizer core/modules/serialization/tests/modules/test_fieldtype_boolean_emoji_normalizer/src/Normalizer/BooleanItemNormalizer.php Normalizes boolean fields weirdly: renders them as ๐Ÿ‘ (TRUE) or ๐Ÿ‘Ž (FALSE). 2
BooleanItemTest class Drupal\Tests\field\Kernel\Boolean core/modules/field/tests/src/Kernel/Boolean/BooleanItemTest.php Tests the new entity API for the boolean field type.
BooleanNormalizer class Drupal\test_datatype_boolean_emoji_normalizer\Normalizer core/modules/serialization/tests/modules/test_datatype_boolean_emoji_normalizer/src/Normalizer/BooleanNormalizer.php Normalizes boolean data weirdly: renders them as ๐Ÿ‘ (TRUE) or ๐Ÿ‘Ž (FALSE). 2
BooleanOperator class Drupal\views\Plugin\views\filter core/modules/views/src/Plugin/views/filter/BooleanOperator.php Simple filter to handle matching of boolean values. 3 2
BooleanOperatorString class Drupal\views\Plugin\views\filter core/modules/views/src/Plugin/views/filter/BooleanOperatorString.php Simple filter to handle matching of boolean values.
BootstrapConfigStorageFactory class Drupal\Core\Config core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php Defines a factory for retrieving the config storage used pre-kernel. 2
Box class Drupal\block_content\Plugin\migrate\source\d6 core/modules/block_content/src/Plugin/migrate/source/d6/Box.php Drupal 6 block source from database.
BoxTest class Drupal\Tests\block_content\Kernel\Plugin\migrate\source\d6 core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d6/BoxTest.php Tests D6 block boxes source plugin.
BoxTranslation class Drupal\block_content\Plugin\migrate\source\d6 core/modules/block_content/src/Plugin/migrate/source/d6/BoxTranslation.php Drupal 6 i18n custom block translations source from database.
BoxTranslationTest class Drupal\Tests\block_content\Kernel\Plugin\migrate\source\d6 core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d6/BoxTranslationTest.php Tests i18n custom block translations source plugin.
Breadcrumb class Drupal\Core\Breadcrumb core/lib/Drupal/Core/Breadcrumb/Breadcrumb.php Used to return generated breadcrumbs with associated cacheability metadata. 12
Breadcrumb404Test class Drupal\FunctionalTests\Breadcrumb core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php Tests the breadcrumb of 404 pages.
BreadcrumbBuilderInterface interface Drupal\Core\Breadcrumb core/lib/Drupal/Core/Breadcrumb/BreadcrumbBuilderInterface.php Defines an interface for classes that build breadcrumbs. 7 7
BreadcrumbFrontCacheContextsTest class Drupal\Tests\system\Functional\Menu core/modules/system/tests/src/Functional/Menu/BreadcrumbFrontCacheContextsTest.php Tests breadcrumbs functionality.
BreadcrumbManager class Drupal\Core\Breadcrumb core/lib/Drupal/Core/Breadcrumb/BreadcrumbManager.php Provides a breadcrumb manager. 1 2
BreadcrumbManagerTest class Drupal\Tests\Core\Breadcrumb core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php @coversDefaultClass \Drupal\Core\Breadcrumb\BreadcrumbManager @group Breadcrumb
BreadcrumbTest class Drupal\Tests\Core\Breadcrumb core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php @coversDefaultClass \Drupal\Core\Breadcrumb\Breadcrumb @group Breadcrumb
BreadcrumbTest class Drupal\Tests\system\Functional\Menu core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php Tests breadcrumbs functionality.
BreakLockForm class Drupal\views_ui\Form core/modules/views_ui/src/Form/BreakLockForm.php Builds the form to break the lock of an edited view.
BreakLockLink class Drupal\Core\TempStore\Element core/lib/Drupal/Core/TempStore/Element/BreakLockLink.php Provides a link to break a tempstore lock.
Breakpoint class Drupal\breakpoint core/modules/breakpoint/src/Breakpoint.php Default object used for breakpoint plugins. 1
BreakpointDiscoveryTest class Drupal\Tests\breakpoint\Kernel core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php Tests discovery of breakpoints provided by themes and modules.
BreakpointInterface interface Drupal\breakpoint core/modules/breakpoint/src/BreakpointInterface.php Interface for Breakpoint plugins. 1 1
BreakpointManager class Drupal\breakpoint core/modules/breakpoint/src/BreakpointManager.php Defines a breakpoint plugin manager to deal with breakpoints. 2
BreakpointManagerInterface interface Drupal\breakpoint core/modules/breakpoint/src/BreakpointManagerInterface.php Defines an interface for breakpoint managers. 1 1
BreakpointTest class Drupal\Tests\breakpoint\Unit core/modules/breakpoint/tests/src/Unit/BreakpointTest.php @coversDefaultClass \Drupal\breakpoint\Breakpoint @group Breakpoint
Broccoli class Drupal\Tests\Component\Plugin\Fixtures\vegetable core/tests/Drupal/Tests/Component/Plugin/Fixtures/vegetable/Broccoli.php Plugin annotation @Plugin( id = "broccoli", label = "Broccoli", color = "green" ) 1
Broken class Drupal\Core\Entity\Plugin\EntityReferenceSelection core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/Broken.php Defines a fallback plugin for missing entity_reference selection plugins.
Broken class Drupal\Core\Block\Plugin\Block core/lib/Drupal/Core/Block/Plugin/Block/Broken.php Defines a fallback plugin for missing block plugins. 1
Broken class Drupal\views\Plugin\views\sort core/modules/views/src/Plugin/views/sort/Broken.php A special handler to take the place of missing or broken handlers.
Broken class Drupal\views\Plugin\views\field core/modules/views/src/Plugin/views/field/Broken.php A special handler to take the place of missing or broken handlers. 1

Other projects


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