Classes, traits, and interfaces - 3.x - examples

Primary tabs

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
DescriptionTemplateTrait trait Drupal\examples\Utility src/Utility/DescriptionTemplateTrait.php Trait to implement a "drop-in" template for Example's controllers. 17
DescriptionTraitTest class Drupal\Tests\examples\Kernel tests/src/Kernel/DescriptionTraitTest.php Test of the Description Trait.
DisplayInfoInterface interface Drupal\phpunit_example modules/phpunit_example/src/DisplayInfoInterface.php An interface to objects that provide displayable information. 1
DisplayManager class Drupal\phpunit_example modules/phpunit_example/src/DisplayManager.php An example class to demonstrate unit testing. 1
DisplayManagerTest class Drupal\Tests\phpunit_example\Unit modules/phpunit_example/tests/src/Unit/DisplayManagerTest.php DisplayManager unit test with doubles.
DynamicFormSections class Drupal\ajax_example\Form modules/ajax_example/src/Form/DynamicFormSections.php Dynamically-enabled form with graceful no-JS degradation. 1
DynamicFormSectionsTest class Drupal\Tests\ajax_example\FunctionalJavascript modules/ajax_example/tests/src/FunctionalJavascript/DynamicFormSectionsTest.php Functional test of dependent dropdown example.
DynamicFormSectionsTest class Drupal\Tests\ajax_example\Functional modules/ajax_example/tests/src/Functional/DynamicFormSectionsTest.php Functional test of non-AJAX dependent dropdown example.
EmailExampleGetFormPage class Drupal\email_example\Form modules/email_example/src/Form/EmailExampleGetFormPage.php File test form class. 1
EmailExampleTest class Drupal\Tests\email_example\Functional modules/email_example/tests/src/Functional/EmailExampleTest.php Tests for the email_example module.
EntityAutocomplete class Drupal\ajax_example\Form modules/ajax_example/src/Form/EntityAutocomplete.php A simple autocomplete form which looks up usernames. 1
EntityAutocompleteTest class Drupal\Tests\ajax_example\FunctionalJavascript modules/ajax_example/tests/src/FunctionalJavascript/EntityAutocompleteTest.php Tests the behavior of the entity_autocomplete example.
EventsExampleForm class Drupal\events_example\Form modules/events_example/src/Form/EventsExampleForm.php Implements the SimpleForm form controller. 1
EventsExampleServiceTest class Drupal\Tests\events_example\Kernel modules/events_example/tests/src/Kernel/EventsExampleServiceTest.php Test to ensure 'events_example_subscriber' service is reachable.
EventsExampleSubscriber class Drupal\events_example\EventSubscriber modules/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 modules/events_example/tests/src/Functional/EventsExampleTest.php Test the functionality of the Events Example module.
ExampleConfigurableTextBlock class Drupal\block_example\Plugin\Block modules/block_example/src/Plugin/Block/ExampleConfigurableTextBlock.php Provides a 'Example: configurable text string' block.
ExampleEmptyBlock class Drupal\block_example\Plugin\Block modules/block_example/src/Plugin/Block/ExampleEmptyBlock.php Provides a 'Example: empty block' block.
ExampleFixtureManagementTest class Drupal\Tests\testing_example\Kernel modules/testing_example/tests/src/Kernel/ExampleFixtureManagementTest.php Demonstrate manipulating fixture data in a kernel test.
ExampleFunctionalTest class Drupal\Tests\testing_example\Functional modules/testing_example/tests/src/Functional/ExampleFunctionalTest.php Class ExampleFunctionalTest.
ExampleHamSandwich class Drupal\plugin_type_example\Plugin\Sandwich modules/plugin_type_example/src/Plugin/Sandwich/ExampleHamSandwich.php Provides a ham sandwich. 1
ExampleMeatballSandwich class Drupal\plugin_type_example\Plugin\Sandwich modules/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. 16 15
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 modules/block_example/src/Plugin/Block/ExampleUppercaseBlock.php Provides a 'Example: uppercase this please' block.
FapiExampleTest class Drupal\Tests\form_api_example\Functional modules/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 modules/field_example/tests/src/Functional/FieldExampleBrowserTestBase.php Class FieldExampleBrowserTestBase. 5
FieldExampleController class Drupal\field_example\Controller modules/field_example/src/Controller/FieldExampleController.php Controller for field example description page.
FieldExampleMenuTest class Drupal\Tests\field_example\Functional modules/field_example/tests/src/Functional/FieldExampleMenuTest.php Test the user-facing menus in Field Example.
FieldNote class Drupal\field_permission_example\Plugin\Field\FieldType modules/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 modules/field_permission_example/tests/src/Kernel/FieldNoteItemTest.php Tests our sticky-note field type.
FieldPermissionExampleController class Drupal\field_permission_example\Controller modules/field_permission_example/src/Controller/FieldPermissionExampleController.php Controller routines for field permission example routes.
Fixtures class Drupal\tabledrag_example modules/tabledrag_example/src/Fixtures.php Provides sample data for module's examples. 2
FrontPageLinkDependenciesTest class Drupal\Tests\testing_example\Functional modules/testing_example/tests/src/Functional/FrontPageLinkDependenciesTest.php Tests core menu behavior.
FrontPageLinkTest class Drupal\Tests\testing_example\Functional modules/testing_example/tests/src/Functional/FrontPageLinkTest.php Tests for the existence of links on the front page.
HooksExampleController class Drupal\hooks_example\Controller modules/hooks_example/src/Controller/HooksExampleController.php Controller for Hooks example description page.
HooksExampleTest class Drupal\Tests\hooks_example\Functional modules/hooks_example/tests/src/Functional/HooksExampleTest.php Test the functionality of the Hooks Example module.
IncidentEvents final class Drupal\events_example\Event modules/events_example/src/Event/IncidentEvents.php Defines events for the events_example module. 2
IncidentReportEvent class Drupal\events_example\Event modules/events_example/src/Event/IncidentReportEvent.php Wraps a incident report event for event subscribers. 2
InputDemo class Drupal\form_api_example\Form modules/form_api_example/src/Form/InputDemo.php Implements InputDemo form controller. 1
JsExampleController class Drupal\js_example\Controller modules/js_example/src/Controller/JsExampleController.php Controller for Hooks example description page.
JsExampleTest class Drupal\Tests\js_example\Functional modules/js_example/tests/src/Functional/JsExampleTest.php Functional tests for the js_example module.
Marquee class Drupal\render_example\Element modules/render_example/src/Element/Marquee.php Provides a marquee render element.
MenuExampleController class Drupal\menu_example\Controller modules/menu_example/src/Controller/MenuExampleController.php Controller routines for menu example routes.
MenuExampleDynamicRoutes class Drupal\menu_example\Routing modules/menu_example/src/Routing/MenuExampleDynamicRoutes.php Defines dynamic routes for our tab menu items.
MenuExampleTest class Drupal\Tests\menu_example\Functional modules/menu_example/tests/src/Functional/MenuExampleTest.php Test the functionality for the menu Example.
MockSessionTrait trait Drupal\Tests\stream_wrapper_example\Traits modules/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 modules/form_api_example/src/Form/ModalForm.php Implements the ModalForm form controller. 1
ModalFormTest class Drupal\Tests\form_api_example\FunctionalJavascript modules/form_api_example/tests/src/FunctionalJavascript/ModalFormTest.php @group form_api_example
MultistepForm class Drupal\form_api_example\Form modules/form_api_example/src/Form/MultistepForm.php Provides a form with two steps. 1

Other projects