Entities were introduced in Drupal 7 as a way of taking the things that people loved about nodes + CCK in Drupal 6 and applying them to other types of data like users, comments, and taxonomy terms. The Entity API in Drupal 7 provides a set of common functions and classes to make it easier for developers to create their own custom entity types or to work with existing ones in a generic way. The API in Drupal core however is still missing some really useful tools and is supplemented by the Entity module in Drupal contributed which we'll make heavy use of throughout the series.
In this series we'll learn about the interplay between Entities, Entity Types, Bundles, and Fields and how to write custom code to deal with each of these things. The Entity API demo site files that we use in this series are all located in the Lullabot GitHub, as well as in zip files attached to the respective video pages, under the Downloads tab.
This series covers:
- What entities are and how they fit into the Drupal ecosphere
- EntityFieldQuery
- Entity classes, what they do and how to override them
- Providing an admin UI for adding/editing and deleting entities from Drupal
- Making entities fieldable
- View modes
- Creating custom UI's for dealing with entities
- Describing entity properties to Drupal
- Views integration for entities
- Entity Metadata wrappers
- Making entities revisionable
And much much more. This series assumes that you're already familiar with the basic tenets of writing modules for Drupal and makes use of things like hook_menu() without spending time explaining them. If you're not familiar with Drupal module development, you might want to brush up by watching our Module Development for Drupal 7 first.
Additional resources
Entity API Demo site files on GitHub
Entity module at Drupal.org
This lesson takes a look at working with the already existing entities in Drupal such as users and nodes and demonstrates some best practices for working with them in your own custom module. We'll focus on writing code that will work with any entity type and isn't hard coded to work with just nodes or just entities.
Additional notes:
There is a typo in the video. Joe created the variable $types = 'comment'; in one spot and then used it as entity_load($type, ... which obviously wouldn't work because the later is missing an 's' on the end. The downloadable code for this video doesn't have the typo.
Additional resources
In this lesson Joe will explain what an entity is and provide a little bit of history about how they came into being. We’ll also learn about some of the differences between custom entities and nodes (which happen to be a type of entity) and when, and why you might want to choose to write your own custom entities instead of using the node system or a more traditional datastore.
In this Lullabot Module Monday lesson, we take a look at the Style Guide module. Comparing Drupal themes is tough: the screenshots they provide are often based on heavily tweaked sites with plenty of slider blocks, tweaked media attachments, and other just-so content. Figuring out the "basics" — how a given theme styles core HTML elements and recurring Drupal interface patterns — can be tough! Fortunately, the Style Guide module can help.
Additional resources
In this Lullabot Module Monday lesson we are introduced to the Publish Button module. It's a simple problem, but a serious one. You've put your content editors in front of Drupal for the first time, and they can understand the node form without any problems. They understand taxonomy terms, grok menus and node references… but they get nervous when it's time to save their work. "Will... will this be published as soon as I click 'save?'" Normally, there's no good way to make the distinction between saving and publishing a piece of content explicit. Site builders can set a content type to be unpublished by default, then give editors the broad "administer nodes" permission, but that's clumsy solution that forces editors to dig for what should be a simple action: publishing or unpublishing a post. That's where the Publish Button module comes in.
Additional resources
In this Lullabot Module Monday article, we learn about the Mass Password Reset module. It's a question we all ask ourselves: What would I do if my site or server was compromised? Security professionals have loads of checklists to follow, and experienced server administrators drill for those moments. As we saw when Twitter.com was compromised by hackers, "Reset everyone's passwords, right away!" is almost always one of the important steps. If you run a Drupal site, that particular step can be frustrating. Resetting user passwords one by one is incredibly time consuming, and there's no way to do it for everyone in one fell swoop. At least, there wasn't until the release of the Mass Password Reset module.
Additional resources
In this Lullabot Module Monday lesson we take a look at the Backup and Migrate module. Few things are more terrifying than the realization that a server hiccup has wiped out a web site, or a hasty change deployed to the live site has nuked important content. Fortunately, there's a module that can help. Backup and Migrate offers site builders a host of options for manually and automatically backing up their sites' databases, and integrates with third-party backup services, to boot!
Additional resources
In this Lullabot Module Monday lesson we look at the Word Link module. It's a simple problem, but a tricky one: How can you ensure that special words and phrases, like your company's name or certain trademarks, are always linked to an appropriate web site when they're used in the text of an article? The easy answer is Word Link module: it lets you set up a custom glossary of terms that should be turned into links whenever the appear in text.
Additional resources
In this Lullabot Module Monday lesson we walk through the useful Menu Position module. It's a word that can strike fear into the heart of the bravest site builder: Breadcrumbs. Manage them well, and you'll give visitors a helpful visual indicator of where they're at in your site. Miss a detail, and the weird inconsistencies will be more confusing than no breadcrumbs at all. The challenges stem from Drupal's "flat hierarchy" -- by default, almost all pages (including every node you create) live just beneath the home page itself in an undifferentiated pool of content. All of the visual cues it sends to visitors (breadcrumb trails, highlighted parent items in the navigation menus, and so on) start with that assumption until you override them. That's where the Menu Position module helps out. It lets you set up simple rules that tell Drupal where each node type should go in the site's hierarchy, then handles all of the frustrating details automatically.
Additional resources
The Entity Views Attachment (EVA) module extends the Views module to allow you to attach a view to any entities on your site. Views on its own will let you create a page for your view, with its own URL, and it also lets you attach multiple views to the same Views page, but it doesn't let you do something like attach a view to a node, or a user. This lesson walks through a simple example of creating a basic view listing published articles on a site, and then using EVA to attach that view to user profiles, and making sure that we only list the published articles for that user, using a contextual filter.
Additional resources
The Views Bulk Operations (VBO) module is a great extension for the Views module, which allows you to add bulk operation checkboxes and actions to any view. You often see bulk operations on various Drupal core administration pages, like the content administration screen, which lets you select multiple pieces of content, and then perform an action, like publishing or deleting, on all items at the same time. VBO lets you add this to your administrative screens, which allows you to create very customized reports that also have time-saving actions available to them as well.
Additional resources
Deploying Your Code
FreeIn this lesson we will take the code we have committed to our remote repository and manually push it to our production server. We will cover how to setup deployments on beanstalkapp.com and the some of the advantages of using a tool like this.
A question we are commonly asked is: how did your production environment recognize the new feature?
Answer: Reverting a feature reverts it back to what is in code. So by updating the code it always looks to the code so there is no need to revert it. You usually revert a feature if you have made changes that are stored in the database and you need it to look back to the code as your database changes are not what you wanted or are wrong. If the changes you made in the database are what you want, then you update/recreate the feature.
In this lesson, we will cover the basics of getting code into version control using the Mac app "Tower" and then making the first commit and pushing it to the remote repository we will setup on beanstalkapp.com.
In this lesson we will cover using Lightbox2 and Colorbox with content in your site. Taking a lightbox beyond just enlarging images, we will demonstrate displaying nodes and using Views with a lightbox.
In this lesson we will use both the Lightbox2 and Colorbox modules in actual real world uses. We will demonstrate how to use each module or helper modules to use with images, create slideshows and galleries.
Lightboxes and Drupal 7
CourseIn this lesson, we will take a look at the Colorbox module and its configuration page. We also will discuss some other helper modules that work great with Colorbox. Later in the series, we will demonstrate some uses of Colorbox and techniques to make the most of it.
Additional resources
Modules Needed
External
In this lesson we will cover the configuration pages for the Lightbox2 module. This module offers a ton of options and the configuration page can be daunting. Later in the series, as we get into using Lightbox2, we will demonstrate how to apply some of these configurations.