User login

Code for Contrib: When There's Not a Module for That

Presenters: mlncn, Stefan Freudenberg, misscs

You won't understand everything about module development this hour, or this week, this month, this year, or this decade.

That's why the approach here is to learn how to learn. Not simply, this is what , but what investigation or resource or secret guild of wizards was needed to gain that knowledge?

Drupal is a powerful and modular system— indeed, much of Drupal's power is in its modules, dynamos of pluggable functionality that can build on Drupal's base system and other modules. This session shows how to add features of your own creation in Drupal 7.

You can write a module yourself. All you need to do is create two files with some text. Once we've dispensed with the myth of module making as the difficult domain of die-hard Drupalistas, we will then go well beyond an easy example, and try to make you a die-hard Drupalista!

In the context of a couple real examples, we will cover these APIs:

  • form_alter – if you learn one hook, let this be it. It's just so much fun.
  • menu – this is the power of defining our own pages, among other things
  • database – the new Drupal 7 database abstraction layer, aka DBTNG
  • node – nodeAPI is de-opped in 7 (it is many focused functions instead of one big switchy/twitchy one)
  • taxonomy – yup, de-opped too, and made into fields...
  • field – yeah this is the big D7 deal
  • entity – the big deal API making fields possible, including the Entity API module
  • help – and it's big sister, advanced_help
  • theme and render – because modules have to make themselves themable
  • permissions – using and defining
  • AJAX – enhancing usability with immediate on-page response

The methods and tips in this session will be based on the real work of figuring out how to do specific things with Drupal. Our goal is that you learn more than this session teaches you: How to keep learning about module development from Drupal core, from the Examples project, from contributed modules, and from all the other Drupalistas out there.

This session will be focused on code far more than Module Number 10,000, but will carry forward the wide approach with tips on being a celebrated and sane module maintainer.

Intended Audience

Developers looking to improve their module development processes, to get up to speed on (more of) Drupal 7, or to heckle.

People with a module they've written and want to make better before contributing.

Anyone serious about learning Drupal 7 module development.

Configurators who have realised they need to write some custom code or fill in some missing pieces to take their project to the next level.

Questions the session will answer

  1. How do I write a module that plays well with Drupal core and other modules? (hint: uses lots of hooks)
  2. How do I make a module is extensible by other modules? (hint: defines its own hooks!)
  3. How do I make my module easy for users and administrators to use and developers to understand? (hint: contextual links, help, coding standards)
  4. How do I know when my module is good enough to ship? Where do I get help making it good enough – and secure enough – to contribute to Drupal.org?
  5. How do I learn things that aren't covered in this session? How do I find answers in other people's code?

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.