Using Drupal comes with source code intended to be used throughout the lessons to make following the lessons much easier. In this lesson we're going to take a look at what that source code provides for us, where we can get a copy of, and how to use it. We'll go through the installation process, as well as see how we can switch between chapters in the source code without destroying work you've done on previous chapters. It is important to note that using the source code is very important if you want the lessons to match what is in the lessons. Drupal modules can change a lot over time, and the source code is designed to exactly match what is covered in the lessons. Once you've learned the basics of a chapter by working through the source code, you can upgrade your modules and explore the differences in newer versions, with the base understanding you've gained from the lesson.
Warning: Since this Drupal code is several years old, you must use PHP 5.3. PHP 5.4 or higher will not work. You will need to make sure your server is using PHP 5.3 in order to use this code properly. Many all-in-one servers, like WAMP, MAMP, and XAMPP provide older versions of PHP and a way to switch back and forth between versions.
Additional resources
The Using Drupal series of lessons walks through the O'Reilly book, Using Drupal, written by Angie Byron, Addison Berry, and Bruno de Bondt. We use the second edition, which covers Drupal 7. The book starts off with taking a look at Drupal Core and then works through various case studies using a wide range of contributed modules from the Drupal project.
The video series follows along with what's in the book, so if you have the book, the videos are really great supplemental material. Even without the book, you’ll get the full lessons here in the videos.
This series is intended for people who have worked with the web and understand how a website gets delivered, and in particular, how to get a website onto a web server so that people can actually see it and use it. The rest of this introductory series we have here will look at how the book relates to the video series we're going to be creating, and how you can use those 2 together.
Additional resources
Using Drupal Book in Video Lessons
Blog postMany moons ago, back in 2008, several Lullabots wrote the first edition of Using Drupal, published by O'Reilly Media. In 2012, myself and Angie Byron, with the help of Bruno DeBondt, updated Using Drupal with a second edition for Drupal 7. This year we're happy to announce the video version of Using Drupal.
In the latest podcast episode, BDD, Behat, and Drupal, the Drupalize.Me team is joined by Melissa Anderson (eliza411) to talk about Behavior-Driven Development (BDD) and using a testing tool called Behat.
Oscon Can Be Worth the Investment
Blog postIn a few short weeks I'll be headed on the road once again for two great events: Twin Cities DrupalCamp and OSCON. On the surface these two events couldn't be more different. One is intimate, inexpensive, and full of Drupal. The other is big, an investment, and has hardly any Drupal. Seems like an obvious win for Twin Cities DrupalCamp, right? Well, let's dive a little deeper into what makes OSCON worth the price tag.
Setting up Your Developer Environment
Blog postIn my new position at Drupalize.Me I have the luxury of helping a lot of projects in little ways. Being able to context switch quickly helps a lot. This means I've put a lot of time into how my workstation is setup so that I can easily move from one project to another. With the new job I also decided to add OSX to the mix of computers that I use on a daily basis.
In episode 20 of the Drupalize.Me podcast, we're fortunate to be joined by guest Chris Eppstein, the creator of Compass, and part of the core Sass team. We also have three Lullabot front-end developers on the podcast, Micah Godbolt, Kris Bulman, and Carwin Young.
A month or so ago the Drupalize.Me team started a discussion on how to start helping others learn Drupal 8. We knew Drupal 8 wasn't ready for our typical curriculum and video production process, but thought you would be interested to learn along with us about Drupal 8 as it continues to evolve. This blog post is the kick off to that series. As we stated in a recent podcast where we announced this idea, we need everyone to understand that the things we discuss are still in development and could change, or even be removed from D8 altogether.
During the week June 24th a mass of Drupal folks will converge on Dublin, Ireland for Drupal Dev Days. This year, in addition to the three days of DrupalCamp that is happening (June 28-30), there is also a week of sprints leading up to the camp, and to the Drupal 8 code freeze deadline. This is it. If it's going to be in Drupal 8, it needs to happen before the end of June.
See You at Drupalcamp Austin
Blog postWe're pleased as punch to be sponsoring DrupalCamp Austin in Austin, Texas from June 21st through 23rd. This year's camp is packed, with one day of all-day workshops, several half-day workshops, three tracks of sessions over two days, and two keynotes.
We'd Like to Sponsor Your User Group
Blog postWe're happy to announce a new program to sponsor user groups around the world: Meetup Memberships. We're giving user groups FREE access to the entire Drupalize.Me library on days that you have meetups or camps planned. It's like having a Drupalize.Me instructor show up at your event, anywhere, anytime! Here's how it works:
In this podcast episode, Building Lullabot.com, Addi is joined by the Lullabot team that worked on the new Lullabot.com redesign and upgrade. The conversation covers a lot of the lessons learned from doing an internal project on the side of regular client work.
NOTE: Support of Dreditor has been nominal for a while. It's still the preferred tool for enhancing Drupal's issue queue, but keeping track of what the "official" version is can be tricky. For now, we recommend https://dreditor.github.io/. There's also been work happening to incorporate many of Dreditor's features right into Drupal.org itself. See https://www.drupal.org/project/drupalorg/issues/1673278
Dreditor is a great community tool that assists with things like patch reviews, and generally interacting with the Drupal.org issue queue. Dreditor is not a Drupal module, but is a plugin script you use in your browser. In this lesson, Joe walks through how to get Dreditor installed (on Chrome and Firefox), and then shows you how to use it to make your work in the issue queues more efficient.
Additional resources
On the eve of DrupalCon Portland, we're happy to be able to get another free community video out, Installing and Using Dreditor. What's more exciting though, is that this video is part of our Community Tools workshop, and in an effort to spread Drupal community involvement further than where we can show up to run this free workshop, we're putting all of our materials and notes online for everyone to use freely, with the Community Tools curriculum.
A Workshop is Born
This Friday's podcast, The Mysterious Drupal Entity has Kyle, Joe, and Blake joined by Greg Dunlap to talk about Drupal entities. What are they? Why do we have them? What do they look like in Drupal 8? We look at it from both the developer and site builder sides to try and get a grip on a topic that leaves a lot of people scratching their heads.
Revisions are an important concept in a content management system. Keeping track of all the edits that have been made to a particular entity over the course of its lifetime. A paper trail or sorts. This lesson takes a look at what is required in order to make our Entities support revisions.
If you've worked with Drupal's node system and enabled revisions then you've seen Drupal's basic revision handling in action. Every time you save a node, it creates a new version of that node. You can roll back to previous versions and keep track of how a piece of content has changed over time. Entity API also supports the concept of revisions and in this lesson we're going to take a look at adding revision support for our video entities.
In order to take advantage of this feature, we'll need to modify our database schema to accommodate storing multiple versions of the same entity. We'll move all fields that we want to make "revisionable" into a separate table and set up a new unique version ID field so that we can keep track of revisions.
Then we will update our hook_entity_info
implementation to tell the API that we want to use the revision system and make some changes to the code in our VideoEntityController
so that when an entity is updated we save a revision instead of overwriting the current data.
Finally we'll need to write a simple UI for viewing older versions of our video entity because the Entity API does not provide us with this code by default.
If you've done any module development, you're probably familiar with hook_node_view and Drupal's arrays of doom. In this lesson we'll show you how to get easier access to the same information using entity metadata wrappers. We will use the entity_metadata_wrapper function to retrieve a new EntityMetaDataWrapper
object that provides an interface for easily accessing an entities property and field values. We'll use the getPropertyInfo
method to expose information about individual properties, and the getIterator
method to access fields that contain multiple values, such as tags. You'll see that by using meta data wrappers you can also access properties on referenced entities, such as the email address of the author of a node, without having to load that information independently.
Metadata wrappers also provide a consistent way to access properties common to all entities. For example, every entity in Drupal has a unique ID property or a human readable label, but these properties often have different names. User name vs. node title. Metadata wrappers allow you to access this information in a consistent way.
Additional resources
In order to make the most of the entity APIs integration with other modules, such as Views, we need to describe the properties of our entity in more detail. The API can infer some information about a property based on our schema but we need to tell it that the integer stored in the updated_at column is actually a timestamp. We will do this by implementing hook_entity_property_info()
and describing each of our entities properties. With these definitions in place you will be able to use the formatters in Views much like you would for individual fields on content types provided by core.
Note: Before you implement hook_entity_property_info()
the API makes an educated guess about each property but once you've defined a single property, the API expects you to define all of the properties for your entity. Use the .install
file in your module to get a complete list of the properties you need to define with hook_property_entity_info
. You can also define additional properties that aren't mapped to fields in the database (these can be used for static properties).