Planet Drupal

Implementing breadcrumbs in Drupal can be difficult depending on your requirements. Drupal out of the box will generate a breadcrumb based off the menu structure, however, things start to get a little tricky when you want to modify breadcrumbs.

There are a lot of modules that allow you to control breadcrumbs in their own unique way. To name a few you have Crumbs, Custom Breadcrumbs and more.

The module that I've had the most success with is the Path Breadcrumbs. This module offers great flexibility with an easy to use interface. Path Breadcrumbs' configuration can also be exported using Features which is another huge win.

Machine names are all over the place in Drupal 7. When you create a content type or field it will appear next to the label. The concept of a machine name is simple. It's an alphanumeric value which shouldn't change once created and it must be unique.

A custom machine name can be implemented in two ways: as a field or form element. If you're creating a form you can implement one using machine_name form element. On content types, you can use the Machine name field.

In this tutorial, you'll learn how to setup and use the machine name field on an article content type.

Display Suite is one of the essential modules which I use on every project. It allows you to change the look and feel of entity bundles, i.e., content types, vocabularies, users and much more. Building custom layouts and adding fields is a breeze, but there's another feature you may not be aware of and that's custom field templates. Display Suite allows you to change the markup which is used to render individual fields.

The functionality to change field templates is off by default. To turn it on, you'll need to enable the "Display Suite Extras" sub-module and check the "Field Templates" on the Extras page.

In this tutorial, you'll learn how to enable "Field Templates" and how to use them.

Search API has been my go-to module for building search pages for the last two years. Even if the client doesn't ask for anything fancy, I still download and install Search API, use Database Search for the index and Views for the page.

If you start with Search API from the beginning, then it's easier to customise later on. The core Search module, on the other hand, is easy to setup but hard to modify.

Recently, I had to create a search page that highlighted the keywords in the results. If you search using a particular keyword, then the word is highlighted.

View modes allow site builders to display the same piece of content in various ways. Drupal ships with a bunch of them out of the box like Teaser, "Full content", RSS and much more. There is even one for the search result page called "Search result". However, the two most prominent are Teaser and "Full content".

The "Full content" view mode is the one used to display content on its "node/123" page. It's the one you'll customise the most. Teaser, on the other hand, is used to display a summarised or trimmed down version of an article.

You can create as many view modes as necessary. But like many things in Drupal, they can be created in a few ways. They can be implemented using code and with a module or two.

In this tutorial, you'll learn how to create view modes in three ways: using hook_entity_info_alter(), using Display Suite and Entity view modes.

When you need to dynamically display a block within a region, nothing can really beat the Context module. It allows you to define a set of conditions, that when met, executes a set of reactions. For example, you could create a context rule which adds a block to the sidebar second region (reaction) when a user is viewing an Article content type (condition).

A lot of what Context does can also be achieved using Panels. But if you're new to Drupal, and never used Panels than Context will be easier to use.

If you're new to Context then I would highly recommend you watch the two introductory videos below:

Recently I've discovered a powerful module called Context entity field. It allows you to define a condition that checks the value of a field on an entity.

Every Drupal site builder will at some point experience the dread of accidentally making configuration changes on production thinking it's their local site. This sort of thing can easily happen when you have 20 tabs opened and forget which site you're currently browsing.

Luckily there's a module you can use to indicate which environment (local, staging, production, etc.) you're currently viewing and it's called Environment Indicator.

The module helps to separate each environment by displaying a coloured indicator. The indicator itself is fully configurable. You can change its colour, position and text.

In this tutorial, you'll learn how to create an indicator in two ways: through the module's UI and with some code in settings.php.

Whenever I post a tutorial about sending emails using Drupal, the first question I get asked is how to send emails as HTML. By default, emails are sent as plain text in Drupal 7. There are a few modules out there that allow you to send emails as HTML like Mime Mail, HTML Mail and Swift Mailer.

There are a few benefits in sending emails as HTML. For one thing, they can be styled and images can be displayed. Also, it's easier to track open rates and clicks if the email is HTML. However, there are some downsides to using HTML. One thing I've read about is that HTML emails are more likely to be flagged as spam. Especially if your whole email is just a single image.

In this tutorial, you'll learn how to use Mime Mail to configure Drupal to send HTML emails. We'll also look at how to send them using Rules.

The standard look and feel of Bootstrap is unmistakable and often you can spot a website using it a mile away. The dead giveaways are the buttons and navigation, but it doesn't have to be this way.

If you want to change the look and feel of your Bootstrap site then take a look at Bootswatch. It offers 12 great looking themes, and best of all they are free and open source.

In this tutorial, we'll learn how to use a Bootswatch theme in two ways. The first method will show you how to use the BootstrapCDN and in the second we compile the LESS files ourselves.

So you created a module that you want to put on drupal.org. But just before you release it, you realise it could do with a few default views.

You may think you can use Features for this, but Views allows you to ship default views by creating a module.views_default.inc and implementing hook_views_default_views.

Now, Ctools can be used to generate the required export code that needs to be placed in hook_views_default_views. We'll use a sub-module in Ctools called "Bulk Export" to generate the code.

It's important to understand that there is a difference between "Bulk Export" and Features. The difference is that you can only export CTools' configuration objects using "Bulk Export". Whereas, Features offers full API for integrating any module with it.

In this tutorial, you'll learn how to export default views using "Bulk Export".

Pages

Subscribe to RSS - Planet Drupal