In many cases when you have a search field it can be useful to provide a list of suggestions to the user as they type. This small interaction provides several benefits to the user: It affirms to the user that the site search is working It provides potential searches an alternatives to the user before they even complete a search … Read More
A quick guide to how you can output your content fields any way you like without hacking theme files.
Often your custom module will output HTML. Instead of printing out hardcoded values, which would require a developer to update, in some cases it can be useful to provide an admin area to supply these values. This is a short example of how you can create a basic settings page in the Drupal admin area for your module. We will … Read More
In Drupal we can use permissions to restrict what actions a certain user role can or cannot do. In a recent project I was tasked with implementing a webform that would only be accessible to users who: Had registered a site account Had completed a payment via Paypal For the first criteria you could simply use the core permissions to … Read More
Let’s say you have an area of your website that should only be accessible to registered users. If somebody tries to access this area without being logged in we could either show them the standard ‘Access denied’ page or we could redirect them to log in or create an account first then bring them back. Drupal allows us to append … Read More
Sometimes in addition to having a site form log submissions to the database and send emails we want to POST the data remotely. For example, sending a form submission to a CRM like SalesForce.
In Drupal you can create a content type with a File field that allows multiple values. This means that when a new node is created you can upload several files to attach to the node. When this list is displayed on the front end it is shown as a list in the order the files are in on the edit … Read More
Views in Drupal 7 are a great way of displaying lists of content such as news articles, blog posts or image galleries. By default Views comes with a lot of useful ways to sort these lists: alphabetically by title, chronologically by post date, e.t.c but sometimes there are cases where the order items are displayed in is arbitrary and a … Read More
I’ve set up a few sites that send out email notifications using Rules, commonly for sending out a notification when a user adds a comment to the site so that a site administrator can review it and approve or remove it. The default plain text format for these emails is a little lacklustre. It would much better is we could … Read More
Often when displaying a node in Drupal, such as a news article, event or profile page, it is useful to display a few related pieces of content. This can be achieved by using a taxonomy field on your content and a view. To create a view to display other nodes with the same taxonomy term as the current node Create … Read More