Classes, traits, and interfaces - 11.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 1519

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
AjaxFormHelperTrait trait Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/AjaxFormHelperTrait.php Provides a helper to for submitting an AJAX form. 5
AjaxFormImageButtonTest class Drupal\FunctionalJavascriptTests\Ajax core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormImageButtonTest.php Tests the Ajax image buttons work with key press events.
AjaxFormPageCacheTest class Drupal\FunctionalJavascriptTests\Ajax core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php Performs tests on AJAX forms in cached pages.
AjaxFormsTestAjaxElementsForm class Drupal\ajax_forms_test\Form core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestAjaxElementsForm.php Builds a form where each Form API element triggers a simple Ajax callback. 1
AjaxFormsTestCommandsForm class Drupal\ajax_forms_test\Form core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestCommandsForm.php Form constructor for the Ajax Command display form. 1
AjaxFormsTestImageButtonForm class Drupal\ajax_forms_test\Form core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestImageButtonForm.php Form builder: Builds a form that has image button with an ajax callback. 1
AjaxFormsTestLazyLoadForm class Drupal\ajax_forms_test\Form core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestLazyLoadForm.php Form builder: Builds a form that triggers a simple AJAX callback. 1
AjaxFormsTestSimpleForm class Drupal\ajax_forms_test\Form core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestSimpleForm.php Form builder: Builds a form that triggers a simple AJAX callback. 1
AjaxFormsTestValidationForm class Drupal\ajax_forms_test\Form core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestValidationForm.php Form builder: Builds a form that triggers a simple AJAX callback. 1
AjaxHelperTrait trait Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php Provides a helper to determine if the current request is via AJAX. 7
AjaxInGroupTest class Drupal\FunctionalJavascriptTests\Ajax core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxInGroupTest.php Tests that form elements in groups work correctly with AJAX.
AjaxMaintenanceModeTest class Drupal\FunctionalJavascriptTests\Ajax core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxMaintenanceModeTest.php Tests maintenance message during an AJAX call.
AjaxPageState class Drupal\Core\StackMiddleware core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php Expands the compressed ajax_page_state query parameter into an array. 1 2
AjaxPageStateTest class Drupal\Tests\Core\StackMiddleware core/tests/Drupal/Tests/Core/StackMiddleware/AjaxPageStateTest.php Tests Drupal\Core\StackMiddleware\AjaxPageState.
AjaxPageStateTest class Drupal\Tests\system\Functional\Render core/modules/system/tests/src/Functional/Render/AjaxPageStateTest.php Performs tests for the effects of the ajax_page_state query parameter.
AjaxRenderer class Drupal\Core\Render\MainContent core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php Default main content renderer for Ajax requests. 1 2
AjaxRendererTest class Drupal\Tests\Core\Controller core/tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php Tests Drupal\Core\Render\MainContent\AjaxRenderer.
AjaxResponse class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/AjaxResponse.php JSON response object for AJAX requests. 2 47
AjaxResponseAttachmentsProcessor class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/AjaxResponseAttachmentsProcessor.php Processes attachments of AJAX responses. 2
AjaxResponseSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/AjaxResponseSubscriber.php Response subscriber to handle AJAX responses. 4 2
AjaxResponseTest class Drupal\Tests\Core\Ajax core/tests/Drupal/Tests/Core/Ajax/AjaxResponseTest.php Tests Drupal\Core\Ajax\AjaxResponse.
AjaxTest class Drupal\FunctionalJavascriptTests\Ajax core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php Tests AJAX responses.
AjaxTestCommandReturnPromise class Drupal\ajax_test\Ajax core/modules/system/tests/modules/ajax_test/src/Ajax/AjaxTestCommandReturnPromise.php Test Ajax command. 1
AjaxTestController class Drupal\ajax_test\Controller core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php Provides content for dialog tests. 3
AjaxTestDialogForm class Drupal\ajax_test\Form core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php Dummy form for testing DialogRenderer with _form routes.
AjaxTestFocusFirstForm class Drupal\ajax_test\Form core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestFocusFirstForm.php Form for testing AJAX FocusFirstCommand. 1
AjaxTestForm class Drupal\ajax_test\Form core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestForm.php Dummy form for testing DialogRenderer with _form routes. 1
AjaxTestFormPromise class Drupal\ajax_test\Form core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestFormPromise.php Test form for ajax_test_form_promise. 1
AjaxTestImageEffect class Drupal\image_module_test\Plugin\ImageEffect core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/AjaxTestImageEffect.php Provides a test effect using Ajax in the configuration form.
AjaxTestMessageCommandForm class Drupal\ajax_test\Form core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestMessageCommandForm.php Form for testing AJAX MessageCommand. 1
AjaxWaitTest class Drupal\FunctionalJavascriptTests core/tests/Drupal/FunctionalJavascriptTests/AjaxWaitTest.php Tests that unnecessary or untracked XHRs will cause a test failure.
AlertCommand class Drupal\Core\Ajax core/lib/Drupal/Core/Ajax/AlertCommand.php AJAX command for a javascript alert box. 6
AlertsJsonFeedTest class Drupal\Tests\announcements_feed\FunctionalJavascript core/modules/announcements_feed/tests/src/FunctionalJavascript/AlertsJsonFeedTest.php Test the access announcement according to json feed changes.
AliasingResourceTypeRepository class Drupal\jsonapi_test_field_aliasing\ResourceType core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/src/ResourceType/AliasingResourceTypeRepository.php Provides a repository of resource types with field names that can be aliased. 2
AliasManager class Drupal\path_alias core/modules/path_alias/src/AliasManager.php The default alias manager implementation. 3 2
AliasManagerInterface interface Drupal\path_alias core/modules/path_alias/src/AliasManagerInterface.php Find an alias for a path and vice versa. 3 10
AliasManagerTest class Drupal\Tests\path_alias\Unit core/modules/path_alias/tests/src/Unit/AliasManagerTest.php Tests Drupal\path_alias\AliasManager.
AliasPathProcessor class Drupal\path_alias\PathProcessor core/modules/path_alias/src/PathProcessor/AliasPathProcessor.php Processes the inbound and outbound path using path alias lookups. 3 2
AliasPathProcessorTest class Drupal\Tests\path_alias\Unit\PathProcessor core/modules/path_alias/tests/src/Unit/PathProcessor/AliasPathProcessorTest.php Tests Drupal\path_alias\PathProcessor\AliasPathProcessor.
AliasPrefixList class Drupal\path_alias core/modules/path_alias/src/AliasPrefixList.php Cache a list of valid alias prefixes. 1 1 2
AliasPrefixListInterface interface Drupal\path_alias core/modules/path_alias/src/AliasPrefixListInterface.php Cache a list of valid alias prefixes. 2
AliasRepository class Drupal\path_alias core/modules/path_alias/src/AliasRepository.php Provides the default path alias lookup operations. 1 2 2
AliasRepositoryInterface interface Drupal\path_alias core/modules/path_alias/src/AliasRepositoryInterface.php Provides an interface for path alias lookup operations. 1 1
AliasTest class Drupal\Tests\path_alias\Kernel core/modules/path_alias/tests/src/Kernel/AliasTest.php Tests path alias CRUD and lookup functionality.
AliasWhitelist

in drupal:11.1.0 and is removed from drupal:12.0.0. Use \Drupal\path_alias\AliasPrefixList instead.

class Drupal\path_alias core/modules/path_alias/src/AliasWhitelist.php Cache a list of valid alias prefixes. 2
AliasWhitelistInterface

in drupal:11.1.0 and is removed from drupal:12.0.0. Use \Drupal\path_alias\AliasPrefixListInterface instead.

interface Drupal\path_alias core/modules/path_alias/src/AliasWhitelistInterface.php Cache a list of valid alias prefixes.
Alignment class Drupal\ckeditor5\Plugin\CKEditor5Plugin core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Alignment.php CKEditor 5 Alignment plugin. 1 1
AlignmentPluginTest class Drupal\Tests\ckeditor5\Unit core/modules/ckeditor5/tests/src/Unit/AlignmentPluginTest.php Tests Drupal\ckeditor5\Plugin\CKEditor5Plugin\Alignment.
AllExceptHostEntity class Drupal\entity_reference_test\Plugin\EntityReferenceSelection core/modules/system/tests/modules/entity_reference_test/src/Plugin/EntityReferenceSelection/AllExceptHostEntity.php Allows access to all entities except for the host entity.
AllowDirectWrite final class Drupal\package_manager\Attribute core/modules/package_manager/src/Attribute/AllowDirectWrite.php Identifies sandbox managers which can operate on the running code base. 3

Other projects


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