Creating Custom Beans in Drupal, Part 2
by Aaron Froehlich
*Feel free to browse the code from this tutorial in my sandbox repository at Drupal.org.
In Part 1 of this tutorial, we created a custom Bean type that provides reusable blocks of tweets from a specified twitter user. In Part 2, we will continue improving our custom bean type by upgrading to the Twitter 1.1 API, which will also give us the opportunity to address some typical decisions that you might face during development of a project, such as:
- the tradeoffs between custom code and javascript libraries
- the use of 3rd party php libraries
- different ways of handling API keys and secrets
The code we wrote in Part 1 was intentionally pretty simple, and Twitter's V1 API supported us in that regard because it allowed non-authenticated access to user timelines. This highlights a situation that is typical with 3rd party integrations: we've created a dependency between our application and Twitter's API. Now that one of our dependencies has changed, it begs the question again: is a custom module the way to go? What are the alternatives?...