Classes, traits, and interfaces - 8.x-1.x - examples

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
DisplayManager class Drupal\phpunit_example phpunit_example/src/DisplayManager.php An example class to demonstrate unit testing. 1
DisplayManagerTest class Drupal\Tests\phpunit_example\Unit phpunit_example/tests/src/Unit/DisplayManagerTest.php DisplayManager unit test with doubles.
DynamicFormSections class Drupal\ajax_example\Form ajax_example/src/Form/DynamicFormSections.php Dynamically-enabled form with graceful no-JS degradation. 1
DynamicFormSectionsTest class Drupal\Tests\ajax_example\FunctionalJavascript ajax_example/tests/src/FunctionalJavascript/DynamicFormSectionsTest.php Functional test of dependent dropdown example.
DynamicFormSectionsTest class Drupal\Tests\ajax_example\Functional ajax_example/tests/src/Functional/DynamicFormSectionsTest.php Functional test of non-AJAX dependent dropdown example.
EmailExampleGetFormPage class Drupal\email_example\Form email_example/src/Form/EmailExampleGetFormPage.php File test form class. 1
EmailExampleTest class Drupal\Tests\email_example\Functional email_example/tests/src/Functional/EmailExampleTest.php Tests for the email_example module.
EntityAutocomplete class Drupal\ajax_example\Form ajax_example/src/Form/EntityAutocomplete.php A simple autocomplete form which looks up usernames. 1
EntityAutocompleteTest class Drupal\Tests\ajax_example\FunctionalJavascript ajax_example/tests/src/FunctionalJavascript/EntityAutocompleteTest.php Tests the behavior of the entity_autocomplete example.
EventsExampleForm class Drupal\events_example\Form events_example/src/Form/EventsExampleForm.php Implements the SimpleForm form controller. 1
EventsExampleServiceTest class Drupal\Tests\events_example\Kernel events_example/tests/src/Kernel/EventsExampleServiceTest.php Test to ensure 'events_example_subscriber' service is reachable.
EventsExampleSubscriber class Drupal\events_example\EventSubscriber events_example/src/EventSubscriber/EventsExampleSubscriber.php Subscribe to IncidentEvents::NEW_REPORT events and react to new reports. 1 2
EventsExampleTest class Drupal\Tests\events_example\Functional events_example/tests/src/Functional/EventsExampleTest.php Test the functionality of the Events Example module.
ExampleConfigurableTextBlock class Drupal\block_example\Plugin\Block block_example/src/Plugin/Block/ExampleConfigurableTextBlock.php Provides a 'Example: configurable text string' block.
ExampleEmptyBlock class Drupal\block_example\Plugin\Block block_example/src/Plugin/Block/ExampleEmptyBlock.php Provides a 'Example: empty block' block.
ExampleFixtureManagementTest class Drupal\Tests\testing_example\Kernel testing_example/tests/src/Kernel/ExampleFixtureManagementTest.php Demonstrate manipulating fixture data in a kernel test.
ExampleFunctionalTest class Drupal\Tests\testing_example\Functional testing_example/tests/src/Functional/ExampleFunctionalTest.php Class ExampleFunctionalTest.
ExampleHamSandwich class Drupal\plugin_type_example\Plugin\Sandwich plugin_type_example/src/Plugin/Sandwich/ExampleHamSandwich.php Provides a ham sandwich. 1
ExampleMeatballSandwich class Drupal\plugin_type_example\Plugin\Sandwich plugin_type_example/src/Plugin/Sandwich/ExampleMeatballSandwich.php Provides a meatball sandwich.
ExamplesBrowserTestBase abstract class Drupal\Tests\examples\Functional tests/src/Functional/ExamplesBrowserTestBase.php A standardized base class for Examples tests. 14 13
ExamplesTest class Drupal\Tests\examples\Functional tests/src/Functional/ExamplesTest.php Minimal test case for the examples module.
ExampleUppercaseBlock class Drupal\block_example\Plugin\Block block_example/src/Plugin/Block/ExampleUppercaseBlock.php Provides a 'Example: uppercase this please' block.
FapiExampleTest class Drupal\Tests\form_api_example\Functional form_api_example/tests/src/Functional/FapiExampleTest.php Ensure that the form_api_example forms work properly.
FieldExampleBrowserTestBase abstract class Drupal\Tests\field_example\Functional field_example/tests/src/Functional/FieldExampleBrowserTestBase.php Class FieldExampleBrowserTestBase. 5
FieldExampleController class Drupal\field_example\Controller field_example/src/Controller/FieldExampleController.php Controller for field example description page.
FieldExampleMenuTest class Drupal\Tests\field_example\Functional field_example/tests/src/Functional/FieldExampleMenuTest.php Test the user-facing menus in Field Example.
FieldNote class Drupal\field_permission_example\Plugin\Field\FieldType field_permission_example/src/Plugin/Field/FieldType/FieldNote.php Plugin implementation of the 'field_permission_example' field type.
FieldNoteItemTest class Drupal\Tests\field_permission_example\Kernel field_permission_example/tests/src/Kernel/FieldNoteItemTest.php Tests our sticky-note field type.
FieldPermissionExampleController class Drupal\field_permission_example\Controller field_permission_example/src/Controller/FieldPermissionExampleController.php Controller routines for field permission example routes.
Fixtures class Drupal\tabledrag_example tabledrag_example/src/Fixtures.php Provides sample data for module's examples. 2
FrontPageLinkDependenciesTest class Drupal\Tests\testing_example\Functional testing_example/tests/src/Functional/FrontPageLinkDependenciesTest.php Tests core menu behavior.
FrontPageLinkTest class Drupal\Tests\testing_example\Functional testing_example/tests/src/Functional/FrontPageLinkTest.php Tests for the existence of links on the front page.
HooksExampleController class Drupal\hooks_example\Controller hooks_example/src/Controller/HooksExampleController.php Controller for Hooks example description page.
HooksExampleTest class Drupal\Tests\hooks_example\Functional hooks_example/tests/src/Functional/HooksExampleTest.php Test the functionality of the Hooks Example module.
IncidentEvents final class Drupal\events_example\Event events_example/src/Event/IncidentEvents.php Defines events for the events_example module. 2
IncidentReportEvent class Drupal\events_example\Event events_example/src/Event/IncidentReportEvent.php Wraps a incident report event for event subscribers. 2
InputDemo class Drupal\form_api_example\Form form_api_example/src/Form/InputDemo.php Implements InputDemo form controller. 1
JsExampleController class Drupal\js_example\Controller js_example/src/Controller/JsExampleController.php Controller for Hooks example description page.
JsExampleTest class Drupal\Tests\js_example\Functional js_example/tests/src/Functional/JsExampleTest.php Functional tests for the js_example module.
Marquee class Drupal\render_example\Element render_example/src/Element/Marquee.php Provides a marquee render element.
MenuExampleController class Drupal\menu_example\Controller menu_example/src/Controller/MenuExampleController.php Controller routines for menu example routes.
MenuExampleDynamicRoutes class Drupal\menu_example\Routing menu_example/src/Routing/MenuExampleDynamicRoutes.php Defines dynamic routes for our tab menu items.
MenuExampleTest class Drupal\Tests\menu_example\Functional menu_example/tests/src/Functional/MenuExampleTest.php Test the functionality for the menu Example.
MockSessionTrait trait Drupal\Tests\stream_wrapper_example\Traits stream_wrapper_example/tests/src/Traits/MockSessionTrait.php A trait to expose a mock session type to PHPUnit tests. 2
ModalForm class Drupal\form_api_example\Form form_api_example/src/Form/ModalForm.php Implements the ModalForm form controller. 1
ModalFormTest class Drupal\Tests\form_api_example\FunctionalJavascript form_api_example/tests/src/FunctionalJavascript/ModalFormTest.php @group form_api_example
MultistepForm class Drupal\form_api_example\Form form_api_example/src/Form/MultistepForm.php Provides a form with two steps. 1
MultistepFormTest class Drupal\Tests\form_api_example\Functional form_api_example/tests/src/Functional/MultistepFormTest.php Tests the Multistep FAPI Example.
NaiveConversionTest class Drupal\testing_example\Tests testing_example/src/Tests/NaiveConversionTest.php Change this class declaration so it extends BrowserTestBase.
NodeTypeExampleController class Drupal\node_type_example\Controller node_type_example/src/Controller/NodeTypeExampleController.php Controller routines for node_type_example.

Other projects