Follow the Examples project on Twitter: https://twitter.com/DrupalExamples
Code Examples For Drupal
The Examples for Developers project aims to provide high-quality, well-documented API examples for a broad range of Drupal core functionality.
The Examples project contains many modules which hopefully illustrate best practices for implementing various Drupal APIs. These modules can be enabled individually, and will typically add menu items to your site, which should guide you through their features. You can then look through the code to see what they are doing.
Developers can learn how to use a particular API quickly by experimenting with the examples, and adapt them for their own use.
How To Use These Modules
You can enable these modules just like any others. They all add menu items leading you to a page on your site that will tell you what they are doing.
You can also browse the documentation generated from this project on api.drupal.org. This gives you the benefit of clickable links between the various functions and classes.
Browse The Repo
You can browse the code itself on the official Drupal cgit site, here: http://cgit.drupalcode.org/examples
Adapt The Code
All of the code in this project is presented under the GNU license, which is the case for all code on drupal.org. You can use and modify this code in your own project under that license.
This project covers only core Drupal APIs. Many other APIs exist, and have their own example code. You can find them by following this link: Non-core Drupal examples.
End Of Life
We are discussing the EOL for Drupal 6, and eventually Drupal 7 here: https://www.drupal.org/node/2642596
How can you help?
I'm glad you asked:
- Most of all, we need you to file an issue every time you find an error or ambiguity or something that could be presented better.
- We need additional examples.
- We need reviews, corrections, and improvements to existing modules.
- We need improvements in the doxygen comments.
- We need help figuring out how to organize this growing mass of examples better, and how to improve the doxygen output on api.drupal.org.
Please feel free to help out in the issue queue. Jump right in.
You can familiarize yourself with The Tao of Examples Development on these issues:
What examples do you need as a developer? Create an issue in the queue if you think there's a need.
Where are the Drupal 8 examples?
We need Drupal 8 examples! :-)
There is a meta issue about converting all the examples... Feel free to take one on: #1880976: [meta] Port examples to D8
Also there is a proposal to move Examples into Drupal core for Drupal 8. #1532612: Move Examples Project into Drupal core
Here some links to run the modules in the project at simplytest.me by branch:
- Maintenance status: Seeking co-maintainer(s)
- Development status: Under active development
- Module categories: Developer, Examples
- Reported installs: 2,810 sites currently report using this module. View usage statistics.
- Downloads: 246,121
- Automated tests: Enabled
- Last modified: May 29, 2016
- Stable releases receive coverage from the Drupal Security Team.
Look for the shield icon below.