Examples

Same name in other branches
  1. 7.x-1.x examples.module \examples
  2. 4.0.x examples.module \examples

Well-documented API examples for a broad range of Drupal core functionality.

Developers can learn how to use a particular API quickly by experimenting with the examples, and adapt them for their own use.

Download the Examples for Developers Project (and participate with submissions, bug reports, patches, and documentation) at http://drupal.org/project/examples

File

./examples.module, line 19

Functions

Title Sort descending File name Summary
examples_toolbar ./examples.module Implements hook_toolbar().
_examples_toolbar_routes ./examples.module Get a list of toolbar links to provide.

Classes

Title Sort descending File name Summary
ExamplesTest tests/src/Functional/ExamplesTest.php Minimal test case for the examples module.

Sub-Topics

Title Sort descending File name Summary
Example: AJAX modules/ajax_example/ajax_example.module These examples show basic AJAX concepts.
Example: Batch API modules/batch_example/batch_example.module Outlines how a module can use the Batch API.
Example: Block modules/block_example/block_example.module Demonstrates code creation of blocks.
Example: Cache API modules/cache_example/cache_example.module Demonstrates how a module can use the Cache API.
Example: Config Entity modules/config_entity_example/config_entity_example.module Implement a Config Entity.
Example: Config Node Type modules/node_type_example/node_type_example.module A basic example of defining a content type through configuration YAML files.
Example: Content Entity modules/content_entity_example/content_entity_example.module Implement a content entity.
Example: Cron modules/cron_example/cron_example.module Example using Cron API, including hook_cron() and @QueueWorker plugins
Example: Database (DBTNG) modules/dbtng_example/dbtng_example.module Database examples, including DBTNG.
Example: Draggable Table Forms modules/tabledrag_example/tabledrag_example.module
Example: Events modules/events_example/events_example.module Demonstrates subscribing to, and dispatching, events.
Example: Field Permissions modules/field_permission_example/field_permission_example.module Example using permissions on a Field API field.
Example: Field Types API modules/field_example/field_example.module Examples using Field Types API.
Example: Forms API modules/form_api_example/form_api_example.module Examples using Forms API.
Example: Hooks modules/hooks_example/hooks_example.module Demonstrates implementing, defining, and invoking hooks.
Example: JavaScript modules/js_example/js_example.module Examples using Drupal 8's built-in JavaScript.
Example: Page modules/page_example/page_example.module This example demonstrates how a module can display a page at a given URL.
Example: Pager modules/pager_example/pager_example.module Output nodes in the table with pagination.
Example: PHPUnit modules/phpunit_example/phpunit_example.module This example demonstrates PHPUnit for Drupal 8 unit testing.
Example: Plugin Types modules/plugin_type_example/plugin_type_example.module Example of how to define a plugin type.
Example: Queue modules/queue_example/queue_example.module Demonstrating the Queue API
Example: Render API modules/render_example/render_example.module The Render API
consists of two parts: one, structured arrays that provide data, and hints
about how that data should be rendered, and two, a rendering pipeline that
can be used to render these arrays into various output formats. This example
moduleā€¦
Example: REST modules/rest_example/rest_example.module This module will give you a brief demonstration of how the REST service
works.
Example: Session modules/session_example/session_example.module Demonstrating how to manipulate sessions in Drupal 8.
Example: Stream Wrappers modules/stream_wrapper_example/stream_wrapper_example.module @group stream_wrapper_example
Example: Tablesort modules/tablesort_example/tablesort_example.module Example of a sortable table display.
Three columns are sortable (Numbers, Letters and Mixture)
We are using TableSort Extender
extend('Drupal\Core\Database\Query\TableSortExtender')
Example: Testing modules/testing_example/testing_example.module This example demonstrates Drupal 8 testing frameworks.
Example: Theming modules/theming_example/theming_example.module Example of Drupal theming.
Example: Tour modules/tour_example/tour_example.module The Tour module allows you you make instructional tours of user interfaces.