Classes, traits, and interfaces - 8.9.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 1511

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
BlockManagerInterface interface Drupal\Core\Block core/lib/Drupal/Core/Block/BlockManagerInterface.php Provides an interface for the discovery and instantiation of block plugins. 1 10
BlockManagerTest class Drupal\Tests\Core\Block core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php @coversDefaultClass \Drupal\Core\Block\BlockManager
BlockPageDisplayVariantSubscriber class Drupal\block\EventSubscriber core/modules/block/src/EventSubscriber/BlockPageDisplayVariantSubscriber.php Selects the block page display variant. 2
BlockPageSettingTest class Drupal\Tests\search\Functional\Update core/modules/search/tests/src/Functional/Update/BlockPageSettingTest.php Tests search blocks upgrade to default page setting.
BlockPageVariant class Drupal\block\Plugin\DisplayVariant core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php Provides a page display variant that decorates the main content with blocks. 1 1
BlockPageVariantTest class Drupal\Tests\block\Unit\Plugin\DisplayVariant core/modules/block/tests/src/Unit/Plugin/DisplayVariant/BlockPageVariantTest.php @coversDefaultClass \Drupal\block\Plugin\DisplayVariant\BlockPageVariant @group block
BlockPlaceEventSubscriber class Drupal\block_place\EventSubscriber core/modules/block_place/src/EventSubscriber/BlockPlaceEventSubscriber.php 2
BlockPlaceTest class Drupal\Tests\block_place\Functional core/modules/block_place/tests/src/Functional/BlockPlaceTest.php Tests the placing a block.
BlockPluginCollection class Drupal\block core/modules/block/src/BlockPluginCollection.php Provides a collection of block plugins. 1
BlockPluginHasSettingsTrayFormAccessCheck class Drupal\settings_tray\Access core/modules/settings_tray/src/Access/BlockPluginHasSettingsTrayFormAccessCheck.php Determines whether the requested block has a 'settings_tray' form. 1 2
BlockPluginHasSettingsTrayFormAccessCheckTest class Drupal\Tests\settings_tray\Unit\Access core/modules/settings_tray/tests/src/Unit/Access/BlockPluginHasSettingsTrayFormAccessCheckTest.php @coversDefaultClass \Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck @group settings_tray
BlockPluginId class Drupal\block\Plugin\migrate\process core/modules/block/src/Plugin/migrate/process/BlockPluginId.php Plugin annotation @MigrateProcessPlugin( id = "block_plugin_id" ) 1
BlockPluginInterface interface Drupal\Core\Block core/lib/Drupal/Core/Block/BlockPluginInterface.php Defines the required interface for all block plugins. 7 21
BlockPluginTrait trait Drupal\Core\Block core/lib/Drupal/Core/Block/BlockPluginTrait.php Provides the base implementation of a block plugin. 1
BlockRebuildTest class Drupal\Tests\block\Kernel core/modules/block/tests/src/Kernel/BlockRebuildTest.php Tests block_rebuild().
BlockRegion class Drupal\block\Plugin\migrate\process core/modules/block/src/Plugin/migrate/process/BlockRegion.php Plugin annotation @MigrateProcessPlugin( id = "block_region" ) 1
BlockRegionTest class Drupal\Tests\block\Unit\Plugin\migrate\process core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php @coversDefaultClass \Drupal\block\Plugin\migrate\process\BlockRegion @group block
BlockRemoveDisabledRegionUpdateTest class Drupal\Tests\block\Functional\Update core/modules/block/tests/src/Functional/Update/BlockRemoveDisabledRegionUpdateTest.php Tests the upgrade path for removal of disabled region.
BlockRenderAlterContent class Drupal\block_test core/modules/block/tests/modules/block_test/src/BlockRenderAlterContent.php Implements a trusted preRender callback.
BlockRenderOrderTest class Drupal\Tests\block\Functional core/modules/block/tests/src/Functional/BlockRenderOrderTest.php Tests blocks are being rendered in order by weight.
BlockRepository class Drupal\block core/modules/block/src/BlockRepository.php Provides a repository for Block config entities. 1 2
BlockRepositoryInterface interface Drupal\block core/modules/block/src/BlockRepositoryInterface.php 1 2
BlockRepositoryTest class Drupal\Tests\block\Unit core/modules/block/tests/src/Unit/BlockRepositoryTest.php @coversDefaultClass \Drupal\block\BlockRepository @group block
BlockResourceTestBase abstract class Drupal\Tests\block\Functional\Rest core/modules/block/tests/src/Functional/Rest/BlockResourceTestBase.php 10 4
BlockResourceTestBase

in drupal:8.6.0 and is removed from drupal:9.0.0. Use Drupal\Tests\block\Functional\Rest\BlockResourceTestBase instead.

abstract class Drupal\Tests\rest\Functional\EntityResource\Block core/modules/rest/tests/src/Functional/EntityResource/Block/BlockResourceTestBase.php
BlockSettings class Drupal\block\Plugin\migrate\process core/modules/block/src/Plugin/migrate/process/BlockSettings.php Plugin annotation @MigrateProcessPlugin( id = "block_settings" )
BlockStorageUnitTest class Drupal\Tests\block\Kernel core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php Tests the storage of blocks.
BlockSystemBrandingTest class Drupal\Tests\block\Functional core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php Tests branding block display.
BlockTemplateSuggestionsTest class Drupal\Tests\block\Kernel core/modules/block/tests/src/Kernel/BlockTemplateSuggestionsTest.php Tests the block_theme_suggestions_block() function.
BlockTest class Drupal\Tests\block\Kernel\Plugin\migrate\source core/modules/block/tests/src/Kernel/Plugin/migrate/source/BlockTest.php Tests block source plugin. 1 1
BlockTest class Drupal\Tests\block\Functional core/modules/block/tests/src/Functional/BlockTest.php Tests basic block functionality.
BlockTest class Drupal\Tests\views\Unit\Plugin\views\display core/modules/views/tests/src/Unit/Plugin/views/display/BlockTest.php @coversDefaultClass \Drupal\views\Plugin\views\display\Block @group block
BlockTest class Drupal\Tests\jsonapi\Functional core/modules/jsonapi/tests/src/Functional/BlockTest.php JSON:API integration test for the "Block" config entity type.
BlockTestBase

in drupal:8.5.0 and is removed from drupal:9.0.0. Use \Drupal\Tests\block\Functional\BlockTestBase.

abstract class Drupal\block\Tests core/modules/block/src/Tests/BlockTestBase.php Provides setup and helper methods for block module tests.
BlockTestBase abstract class Drupal\Tests\block\Functional core/modules/block/tests/src/Functional/BlockTestBase.php Provides setup and helper methods for block module tests. 2
BlockTheme class Drupal\block\Plugin\migrate\process core/modules/block/src/Plugin/migrate/process/BlockTheme.php Plugin annotation @MigrateProcessPlugin( id = "block_theme" )
BlockTranslation class Drupal\block\Plugin\migrate\source\d6 core/modules/block/src/Plugin/migrate/source/d6/BlockTranslation.php Gets i18n block data from source database.
BlockTranslation class Drupal\block\Plugin\migrate\source\d7 core/modules/block/src/Plugin/migrate/source/d7/BlockTranslation.php Gets i18n block data from source database.
BlockTranslationTest class Drupal\Tests\block\Kernel\Plugin\migrate\source\d6 core/modules/block/tests/src/Kernel/Plugin/migrate/source/d6/BlockTranslationTest.php Tests i18n block source plugin.
BlockTranslationTest class Drupal\Tests\block\Kernel\Plugin\migrate\source\d7 core/modules/block/tests/src/Kernel/Plugin/migrate/source/d7/BlockTranslationTest.php Tests i18n block source plugin.
BlockUiTest class Drupal\Tests\block\Functional core/modules/block/tests/src/Functional/BlockUiTest.php Tests that the block configuration UI exists and stores data correctly.
BlockUser class Drupal\user\Plugin\Action core/modules/user/src/Plugin/Action/BlockUser.php Blocks a user.
BlockViewBuilder class Drupal\block core/modules/block/src/BlockViewBuilder.php Provides a Block view builder.
BlockViewBuilderTest class Drupal\Tests\block\Kernel core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php Tests the block view builder.
BlockVisibility class Drupal\block\Plugin\migrate\process core/modules/block/src/Plugin/migrate/process/BlockVisibility.php Plugin annotation @MigrateProcessPlugin( id = "block_visibility" ) 2
BlockVisibilityTest class Drupal\Tests\block\Unit\Plugin\migrate\process core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php Tests the block_visibility process plugin.
BlockXmlAnonTest class Drupal\Tests\block\Functional\Rest core/modules/block/tests/src/Functional/Rest/BlockXmlAnonTest.php @group rest
BlockXmlBasicAuthTest class Drupal\Tests\block\Functional\Rest core/modules/block/tests/src/Functional/Rest/BlockXmlBasicAuthTest.php @group rest
BlockXmlCookieTest class Drupal\Tests\block\Functional\Rest core/modules/block/tests/src/Functional/Rest/BlockXmlCookieTest.php @group rest
BlockXssTest class Drupal\Tests\block\Functional core/modules/block/tests/src/Functional/BlockXssTest.php Tests that the block module properly escapes block descriptions.

Other projects


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