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

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
NodeTypeExampleTest class Drupal\Tests\node_type_example\Functional node_type_example/tests/src/Functional/NodeTypeExampleTest.php Test that our content types are successfully created.
Page class Drupal\form_api_example\Controller form_api_example/src/Controller/Page.php Simple page controller for drupal.
PageExampleController class Drupal\page_example\Controller page_example/src/Controller/PageExampleController.php Controller routines for page example routes.
PageExampleTest class Drupal\Tests\page_example\Functional page_example/tests/src/Functional/PageExampleTest.php Creates page and render the content based on the arguments passed in the URL.
PagerExamplePage class Drupal\pager_example\Controller pager_example/src/Controller/PagerExamplePage.php Controller for pager_example.page route.
PagerExampleTest class Drupal\Tests\pager_example\Functional pager_example/tests/src/Functional/PagerExampleTest.php Tests paging.
PathProcessorSessions class Drupal\stream_wrapper_example\PathProcessor stream_wrapper_example/src/PathProcessor/PathProcessorSessions.php Defines a path processor to rewrite file URLs. 2
PHPUnitExampleController class Drupal\phpunit_example\Controller phpunit_example/src/Controller/PHPUnitExampleController.php Controller for PHPUnit description page.
PHPUnitExampleMenuTest class Drupal\Tests\phpunit_example\Functional phpunit_example/tests/src/Functional/PHPUnitExampleMenuTest.php Test the user-facing menus in PHPUnit Example.
PluginTypeExampleController class Drupal\plugin_type_example\Controller plugin_type_example/src/Controller/PluginTypeExampleController.php Controller for our example pages.
PluginTypeExampleTest class Drupal\Tests\plugin_type_example\Functional plugin_type_example/tests/src/Functional/PluginTypeExampleTest.php Test the functionality of the Plugin Type Example module.
ProtectedPrivates class Drupal\phpunit_example phpunit_example/src/ProtectedPrivates.php A class with features to show how to do unit testing. 1 2
ProtectedPrivatesSubclass class Drupal\Tests\phpunit_example\Unit\Subclasses phpunit_example/tests/src/Unit/Subclasses/ProtectedPrivatesSubclass.php A class for testing ProtectedPrivate::protectedAdd(). 1
ProtectedPrivatesTest class Drupal\Tests\phpunit_example\Unit phpunit_example/tests/src/Unit/ProtectedPrivatesTest.php ProtectedPrivates unit testing of restricted methods.
QueueExampleForm class Drupal\queue_example\Forms queue_example/src/Forms/QueueExampleForm.php Form with examples on how to use queue. 1
QueueExampleTest class Drupal\Tests\queue_example\Functional queue_example/tests/src/Functional/QueueExampleTest.php Tests that our queue_example functions properly.
RenderExampleController class Drupal\render_example\Controller render_example/src/Controller/RenderExampleController.php Provides module description page and examples of building render arrays.
RenderExampleDemoForm class Drupal\render_example\Form render_example/src/Form/RenderExampleDemoForm.php Provides the form for toggling module features on and off. 1
RenderExampleMenuTest class Drupal\Tests\render_example\Functional render_example/tests/src/Functional/RenderExampleMenuTest.php Test the user-facing menus in Render Example.
RenderExampleTest class Drupal\Tests\render_example\Functional render_example/tests/src/Functional/RenderExampleTest.php Test the render example functionality.
ReportWorkerBase abstract class Drupal\cron_example\Plugin\QueueWorker cron_example/src/Plugin/QueueWorker/ReportWorkerBase.php Provides base functionality for the ReportWorkers. 2
ReportWorkerOne class Drupal\cron_example\Plugin\QueueWorker cron_example/src/Plugin/QueueWorker/ReportWorkerOne.php A report worker.
ReportWorkerTwo class Drupal\cron_example\Plugin\QueueWorker cron_example/src/Plugin/QueueWorker/ReportWorkerTwo.php A report worker.
RgbItem class Drupal\field_example\Plugin\Field\FieldType field_example/src/Plugin/Field/FieldType/RgbItem.php Plugin implementation of the 'field_example_rgb' field type.
Robot class Drupal\config_entity_example\Entity config_entity_example/src/Entity/Robot.php Defines the robot entity. 2
RobotAccessController class Drupal\config_entity_example config_entity_example/src/RobotAccessController.php Defines an access controller for the robot entity.
RobotAddForm class Drupal\config_entity_example\Form config_entity_example/src/Form/RobotAddForm.php Class RobotAddForm.
RobotDeleteForm class Drupal\config_entity_example\Form config_entity_example/src/Form/RobotDeleteForm.php Class RobotDeleteForm.
RobotEditForm class Drupal\config_entity_example\Form config_entity_example/src/Form/RobotEditForm.php Class RobotEditForm.
RobotFormBase class Drupal\config_entity_example\Form config_entity_example/src/Form/RobotFormBase.php Class RobotFormBase. 2
RobotListBuilder class Drupal\config_entity_example\Controller config_entity_example/src/Controller/RobotListBuilder.php Provides a listing of robot entities.
RobotReferenceTest class Drupal\Tests\config_entity_example\Functional config_entity_example/tests/src/Functional/RobotReferenceTest.php Ensure Robot entities can be used in entity_reference fields.
RoleAccessCheck class Drupal\menu_example\Access menu_example/src/Access/RoleAccessCheck.php Determines access to routes based on roles. 2
RoutePathTest class Drupal\Tests\examples\Unit tests/src/Unit/RoutePathTest.php Validate paths for routes.
RouteSubscriber class Drupal\menu_example\Routing menu_example/src/Routing/RouteSubscriber.php Listens to the dynamic route events. 2
SampleExampleController class Drupal\examples_description_test\Controller tests/modules/examples_description_test/src/Controller/SampleExampleController.php Simple controller class used to test the DescriptionTemplateTrait. 1
Sandwich class Drupal\plugin_type_example\Annotation plugin_type_example/src/Annotation/Sandwich.php Defines a Sandwich annotation object. 1
SandwichBase abstract class Drupal\plugin_type_example plugin_type_example/src/SandwichBase.php A base class to help developers implement their own sandwich plugins. 2 2
SandwichInterface interface Drupal\plugin_type_example plugin_type_example/src/SandwichInterface.php An interface for all Sandwich type plugins. 1
SandwichPluginManager class Drupal\plugin_type_example plugin_type_example/src/SandwichPluginManager.php A plugin manager for sandwich plugins. 1 2
SessionExampleController class Drupal\session_example\Controller session_example/src/Controller/SessionExampleController.php Controller for a page to display the session information.
SessionExampleForm class Drupal\session_example\Form session_example/src/Form/SessionExampleForm.php Form to allow the user to store information in their session. 1
SessionExampleTest class Drupal\Tests\session_example\Functional session_example/tests/src/Functional/SessionExampleTest.php Tests the basic functions of the Session Example module.
SessionHelper class Drupal\stream_wrapper_example stream_wrapper_example/src/SessionHelper.php Helper to manage file wrapper data stored in the session object. 2 2
SessionHelperTest class Drupal\Tests\stream_wrapper_example\Unit stream_wrapper_example/tests/src/Unit/SessionHelperTest.php PHPUnit test for the SessionHelper session manipulation class.
SessionStreamWrapper class Drupal\stream_wrapper_example\StreamWrapper stream_wrapper_example/src/StreamWrapper/SessionStreamWrapper.php Example stream wrapper class to handle session:// streams. 2
SimpleForm class Drupal\form_api_example\Form form_api_example/src/Form/SimpleForm.php Implements the SimpleForm form controller. 1 1
SimpleFormBlock class Drupal\form_api_example\Plugin\Block form_api_example/src/Plugin/Block/SimpleFormBlock.php Provides a 'Example: Display a form' block.
SimpleFormBlockTest class Drupal\Tests\form_api_example\Functional form_api_example/tests/src/Functional/SimpleFormBlockTest.php Tests \Drupal\form_api_example\Plugin\Block\SimpleFormBlock.
Simplest class Drupal\ajax_example\Form ajax_example/src/Form/Simplest.php A relatively simple AJAX demonstration form. 1

Other projects