Examples

Same name in other branches
  1. 3.x examples.module \examples
  2. 7.x-1.x examples.module \examples
  3. 6.x-1.x examples.module \examples
  4. 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 ajax_example/ajax_example.module These examples show basic AJAX concepts.
Example: Batch API batch_example/batch_example.module Outlines how a module can use the Batch API.
Example: Block block_example/block_example.module Demonstrates code creation of blocks.
Example: Cache API cache_example/cache_example.module Demonstrates how a module can use the Cache API.
Example: Config Entity config_entity_example/config_entity_example.module Implement a Config Entity.
Example: Config Node Type node_type_example/node_type_example.module A basic example of defining a content type through configuration YAML files.
Example: Content Entity content_entity_example/content_entity_example.module Implement a content entity.
Example: Cron cron_example/cron_example.module Example using Cron API, including hook_cron() and @QueueWorker plugins
Example: Database (DBTNG) dbtng_example/dbtng_example.module Database examples, including DBTNG.
Example: Draggable Table Forms tabledrag_example/tabledrag_example.module
Example: Events events_example/events_example.module Demonstrates subscribing to, and dispatching, events.
Example: Field Permissions field_permission_example/field_permission_example.module Example using permissions on a Field API field.
Example: Field Types API field_example/field_example.module Examples using Field Types API.
Example: Forms API form_api_example/form_api_example.module Examples using Forms API.
Example: Hooks hooks_example/hooks_example.module Demonstrates implementing, defining, and invoking hooks.
Example: JavaScript js_example/js_example.module Examples using Drupal 8's built-in JavaScript.
Example: Page page_example/page_example.module This example demonstrates how a module can display a page at a given URL.
Example: Pager pager_example/pager_example.module Output nodes in the table with pagination.
Example: PHPUnit phpunit_example/phpunit_example.module This example demonstrates PHPUnit for Drupal 8 unit testing.
Example: Plugin Types plugin_type_example/plugin_type_example.module Example of how to define a plugin type.
Example: Queue queue_example/queue_example.module Demonstrating the Queue API
Example: Render API 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: Session session_example/session_example.module Demonstrating how to manipulate sessions in Drupal 8.
Example: Stream Wrappers stream_wrapper_example/stream_wrapper_example.module @group stream_wrapper_example
Example: Tablesort 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 testing_example/testing_example.module This example demonstrates Drupal 8 testing frameworks.
Example: Tour tour_example/tour_example.module The Tour module allows you you make instructional tours of user interfaces.