1. 8.x-1.x examples.module examples
  2. 6.x-1.x examples.module examples
  3. 7.x-1.x examples.module examples

Well-documented API examples for a broad range of Drupal 7 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


./examples.module, line 14
This file serves as a stub file for the many Examples modules in the Examples for Developers Project which you can download and experiment with.


Namesort descending Location Description
examples_help ./examples.module Implements hook_help().


Namesort descending Location Description
Example: Action action_example/action_example.module Creating actions in Drupal 7
Example: AJAX ajax_example/ajax_example.module These examples show basic AJAX concepts.
Example: AJAX Graceful Degradation ajax_example/ajax_example_graceful_degradation.inc These examples show AJAX with graceful degradation when Javascript is not available.
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 Outlines how a module can use the Cache API.
Example: Contextual Links contextual_links_example/contextual_links_example.module Example of implementing contextual links.
Example: Cron cron_example/cron_example.module Example using Cron API, including hook_cron() and hook_cron_queue_info().
Example: Database (DBTNG) dbtng_example/dbtng_example.module Database examples, including DBTNG.
Example: Email email_example/email_example.module Example of how to use Drupal's mail API.
Example: Entity entity_example/entity_example.module Example creating a core Entity API entity.
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: Files file_example/file_example.module Examples demonstrating the Drupal File API (and Stream Wrappers).
Example: Filter filter_example/filter_example.module Demonstrates the creation of filters.
Example: Form API form_example/form_example.module Examples demonstrating the Drupal Form API.
Example: Image image_example/image_example.module Demonstrates the basic use of image API.
Example: JavaScript js_example/js_example.module Examples using Drupal 7's built-in JavaScript.
Example: Menu menu_example/menu_example.module Demonstrates uses of the Menu APIs in Drupal.
Example: Node node_example/node_example.module Example defining a node type in code.
Example: Node Access node_access_example/node_access_example.module Demonstrates node access.
Example: NodeAPI nodeapi_example/nodeapi_example.module Example using NodeAPI.
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 Example of a results pager.
Example: Queue queue_example/queue_example.module Demonstrating the Queue API
Example: RDF rdf_example/rdf_example.module Example RDF Mapping.
Example: Render render_example/render_example.module Demonstrate how render arrays are arranged and how they can be altered. This alters blocks and the page to show the actual render array that is being used to create each item.
Example: Simpletest simpletest_example/simpletest_example.module An example of simpletest tests to accompany the tutorial at http://drupal.org/node/890654.
Example: Tabledrag tabledrag_example/tabledrag_example.module Example of draggable table rows.
Example: Tablesort tablesort_example/tablesort_example.module Example of a sortable table display.
Example: Theming theming_example/theming_example.module Example of Drupal theming.
Example: Token API token_example/token_example.module Examples using the Token API.
Example: Trigger trigger_example/trigger_example.module Trigger definition example module.
Example: Vertical Tabs vertical_tabs_example/vertical_tabs_example.module Demonstrates the vertical tabs functionality provided by Drupal 7.
Example: XML-RPC xmlrpc_example/xmlrpc_example.module Demonstration of XML-RPC in Drupal 7.


moe4711’s picture

Hello guys,
thank you for the effort. The examples look nice (good job). I found an error in the Entity Example. When I click the link called "Add an Entity Example Basic Entity", type in a description and click "Save" button, I get the following errors:

- Warning: Illegal offset type in isset or empty in rules_entity_presave() (line 62 of C:\xampp\htdocs\sites\all\modules\rules\modules\events.inc).
- Warning: Illegal offset type in isset or empty in rules_entity_insert() (line 95 of C:\xampp\htdocs\sites\all\modules\rules\modules\events.inc).

Can you fix this? I don't know how to solve it.

Thank you in advance.

core44’s picture

Exactly the same problem here. Cant seem to find a fix either.

core44’s picture

line 303 change...
module_invoke_all('entity_insert', 'basic', $basic);
module_invoke_all('entity_insert', $basic, 'basic');

I noticed the user module passes the arguments in a different order so I took reference from it and tried switching them in the example. Not ran into any errors since.