Shomeya

Two web artists. One amazing company.

A cheat sheet for hook_entity_api()

from Michael Prasuhn on March 26, 2015 11:10am

Article_large_cheat-sheet-preview

The worst time to read software documentation is when you're trying to fix something that is broken and you have no idea why. I'd say it's like shopping when you're hungry, but it's actually the opposite. When stuff breaks for no apparent reason and you're on edge it's easy to notice every little issue with the docs, and you instantly form a very strong opinion on documentation.

The good news is that as a Drupal developer, you have tons of awesome documentation just a click away on api.drupal.org or drupal.org/documentation/develop and contributed module documentation is better than ever. Even though almost everything you could ever want to know about Drupal internals is available on api.drupal.org (even the source code!) sometimes you need to combine that with contributed docs, or dig in a little deeper.

That's exactly what I had to do while working on the first few chapters of Model Your Data with Drupal. Hooks like hook_entity_info() are well documented on api.drupal.org, but the Entity API module adds it's own options to the mix. Entity API has great docs on it's options as well, but there isn't a lot out there that thoroughly documents them together, or the interaction of their options.

Because of that, I decided to add an appendix to Model Your Data with Drupal that details the most common and popular keys for hook_entity_info() and what the recommended defaults are not just when using Drupal core by itself, but when using Entity API as well. After looking at this, I realized that this would make a pretty awesome cheat sheet, which is why you're receiving this email.

I didn't just copy and paste docs from multiple sources to compile this data. With this cheat sheet you'll save yourself time reading deep into common.inc trying to figure out just what properties are actually required. You'll also be able to see where Entity API module takes care of callbacks, and where it doesn't along with which interfaces and classes to implement and extend for various controllers.

The cheat sheet is available via email by signing up at modelyourdatawithdrupal.com.

Along with this cheat sheet, I have more good news: pre-sales of Model Your Data with Drupal start tomorrow. Sales will open with a special launch discount, so keep an eye out for more emails with information on getting the best deal on the book.

I hope this cheat sheet saves you time helps you have a better understanding of one not only one of the most powerful Drupal core subsystems, but also one of the most useful contributed modules for advanced site building.

To get your copy of the cheat sheet, head over to modelyourdatawithdrupal.com and fill out the email sign up form.

blog comments powered by Disqus