Tutorials

Drupal 7 - Ajaxify a form in a popup

Overview

In Drupal 7, it's often beneficial to put various forms into Ajax popups, to create a nice user experience. In this tutorial, we will take Drupal's core-provided password reset form, customize it, and put it in a popup so that when users click the 'forgot password' link, this popup pops up, and allows them to reset their password on the same page. After a sucessful submission, the popup will be hidden and the user will be back on the same page they were on.

This tutorial will show how to do the following:

Drupal: Extending Core Configuration, Extending Core Forms, and Overriding Core Routes

Overview

When working with Drupal, sometimes we will want to do things like extending the configuration of core or another module, extending a form provided by core or another module, and/or overriding forms on a route. At Jaypan, we recently came across a situation like this, where we needed to add a new field to the site for site description, to be used in structured data (aka RDF) for the site we were building. This needed to be a global field, so the most natural place to set the value for the field was on the basic site settings page, located at /admin/config/system/site-information.

In this tutorial, we will explain the method we used to achieve this functionality, going over the given steps, with an explanation of what is happening along the way.

Embedded audio player with externally hosted files on Drupal

Overview

Hosting audio files on a Drupal site can turn into a costly process, between the costs to host the files, as well as the bandwidth costs if the files are listened to regularly. In order to keep costs down, hosting the files on an external service, such as Dropbox, is a preferable alternative. However, as the files are not hosted on the same server as Drupal, it takes a little additional work to get this working, that at the time of writing cannot be done purely with modules.

High Performance JavaScript using Drupal 7's JavaScript API

Overview

In today's web, JavaScript is an essential component of any nice, easy to use website. However, while the basics of JavaScript can be easy to learn, it can be hard to know whether the scripts you are writing are heavy, causing page lag, and making for longer load times.

Drupal comes with an excellent JavaScript API, allowing for the creation of high-performance applications, but it can be confusing to know exactly how to effectively use the API.

Advanced AJAX enabled multi-step forms: creating and altering Drupal entities in custom forms (aka: Wizard forms)

‚Äč

Overview

Sometimes we need to create custom Drupal forms to create or update Drupal Entities, in a different manner than the default forms that we are provided with. In this tutorial, we will look at creating a form 'wizard', that allows a user to create or edit two nodes in a single form.

Drupal 7 - change keyboard types for mobile devices

Overview

With HTML5 comes new <input/> types, which allow for different keyboards on mobile, improving the mobile user experience. However, Drupal by default does not allow for the changing of <input/> types to these new HTML5 types. This tutorial will show how to set up your system to allow for custom input types to be set on any text element.

This tutorial will cover two main steps:

Custom Drupal blocks the right way

Overview

Creating custom blocks in Drupal 7 seems like a pretty straightforward process in Drupal 7. You first implement hook_block_info() to tell Drupal about your block, then you implement hook_block_view() to set the contents of the block for the user. The API pages on these functions explain how to do this, and developers who spend a small bit of time working with these functions can probably get their block working.