Workflow for Extending Drupal

Workflow for extending Drupal

Extending drupal

Drupal's thousands of modules make it one of the world's most versatile web platforms. Working with modules is vital for unlocking Drupal's power. However, when most people get started installing modules, there's this general feeling of, "Okay, I have my module enabled; now what?" The goal of this tutorial is to help you understand the "now what."

About Modules

Many CMS's have modules that give you access to new functionality. Drupal's modules, however, are constructed differently than the traditional module. Other CMS modules tend to provide monolithic features where all the configuration is controlled within that module. I like to think of this as the TV dinner approach. Press a couple of buttons, and dinner's ready. Drupal's modules, on the other hand, tend to provide extendable functionality which enable unique functions and interfaces but delegate some of the functional elements to other modules.

Drupal modules are more like cooking ingredients that you pull together in a recipe to produce fine dining. Unfortunately, the recipe method often seems chaotic to new users. The TV dinner method seems so much easier, and it often is, until you want something different (which always seems to happen). Then the traditional approach hits a brick wall that can only be solved via expensive and difficult-to-maintain custom development. With the Drupal way, you can just change the recipe. You might need to add a few more ingredients, a.k.a modules, but you can create virtually unlimited variations without any custom programming.

Drupal Workflow Demonstration

The key to using Drupal is understanding the general workflow. You first need to enable the modules you require for a desired feature, if it hasn't already been done. But just enabling a module rarely makes a visible difference on the site. You have to configure the module and any related systems. Then you'll need to set where and how you want it to display. Now I'm going to show you an example of this general workflow in action with the Aggregator module.

Enabling Modules

The Aggregator module pulls feeds from other websites and enables you to display articles on your own sites. The first step is to enable it, so we just go to the module link, and then we can look for a module and we actually see that it is here at the top. It is already installed. The files are already on the server, so we don't have to use the process we saw in some other videos. We can just click on this check box and enable it. I scroll down to the bottom and click Save Configuration. Now that it's enabled, let's go back to our site and look at its changes. We refresh, and we don't see that there are any changes on our site. This is actually pretty typical of a Drupal module, that when you first enable it, there's not going to be anything significant that happens.

Configuring Modules

We need to go and configure it first.

  1. There are a couple different ways we can get to the configuration, but I'm going to run back to Modules and use some of the quick links. So here we see we have Help, Permissions, and Configure. I'm going to go ahead and click on Configure.
  2. What we're seeing here is various different settings for how these feeds get pulled in. But what I really want to do is I actually want to go ahead and pull in a new feed. So, I'm going to go to List, and we see there none have been added, so I'm going to go ahead and add a feed.
  3. What I need to do is I need to go and get a feed to work with. I'm going to go ahead and use Planet Drupal's feel, which is at drupal.org/planet, and this is really a feed of Drupal-related news that comes from various different people that do Drupal type of work.
  4. To get the feed, I simply click on the RSS icon, and then I copy this URL out here, run back over here, and I'm going to put that there, and I'm going to give it a title of Planet Drupal. I'm going to go ahead and leave these settings and click Save.
  5. Now, if I run back to my list, we see that I have my Planet Drupal and then go ahead and update items. This is going to pull the feed items in, and we see it pulled 25 items in. So now let me go ahead and close our box and see the changes it's made to our website. Once again, still no changes.

Configuring Display Settings

So we have enabled the module; we have configured the module, but there's one last step we need to go through in order to actually see it impact our website. We need to configure the display settings. One way to do that is I'm going to go to Structure, Blocks, and then I'm going to move this into a visible area of the website. Don't worry too much about what I'm doing right now. We're going to go over how blocks work in later videos. For now, I'm just using this as an example. So I go ahead and click this configuration, and now we see our feed shows up here in our right-hand side bar. The other thing is then click through and do go to More, and we see that we get a full page of the feeds from Planet Drupal. And I could have, if I wanted to, created a menu link so we could have just used this, or we can use the block that gives us a more compact version.

Configure User Permissions

There is one last thing we need to do though. Everything in this browser looks fine because we're logged as a Super User which bypasses all Drupal's permissions. But, if we look at things from another user's point of view, say, for example, an anonymous user who's not logged in, we see that we get an Access Denied. To fix that we need to go and configure the user permissions. We can do that by going to People, if we wanted to, but I'm going to show you another shortcut. Let's just go to Modules, and we see this quick link for permissions, so we'll click on that, and here's our Aggregator permissions. So we need to let anonymous users and authenticated users be able to view our news feeds. I scroll down and click Save Permissions, and now when I run back to our other browser and I hit refresh, we now see that the anonymous user can see our site. So we've no completed all the steps we need to add this new functionality to our site.

Summary

In this tutorial we have seen an example of a general workflow for extending Drupal. Obviously, different modules will have different steps, but the overall process is fairly similar. The Aggregator Module is actually an older Drupal module, and its workflow is fairly basic, but in later videos we'll see numerous examples of more advances processes.