drupal

recent posts related to the drupal content management system

Drupal 8: How to write a simple custom “block module” alvin June 21, 2016 - 8:25pm
Table of Contents1 - Goals2 - Backup your database3 - Check my code out of Github, or create a module directory4 - Create a project info YAML file5 - Create the necessary subdirectories6 - Write the code to display your block7 - Clear the caches8 - Enable the module9 - Place the block module10 - See the custom block on your website11 - The biggest problem I encountered12 - The source code13 - Summary

In this tutorial I’ll demonstrate how to write a simple Drupal 8 “block module.” By this I mean that I’ll show you how to write a simple Drupal 8 module that will display output in a block. When you’re done you will have created a new block that you can place in one or more theme regions.

How to make a Drupal 8 website a static website alvin May 17, 2019 - 6:35pm

The URL I linked to is a story about how to convert a Drupal 8 website into a static website. What it comes down to is, if you’re just running a blog and you don’t care about comments, why bother dealing with all the ugliness of maintaining a Drupal 8 website?

How to install and update Drupal 7 modules from the command line with Drush alvin February 10, 2019 - 6:43pm

As a note to self, I learned today that you can install Drupal 7 modules from the command line with this Drush command:

drush en module_name

such as:

drush en smtp

You can also update Drupal 7 modules with Drush. For instance, I just ran these commands on a Drupal 7 website:

drush up ctools
drush up context
drush up file_entity
drush up media
drush up rules
Notes on how to configure the Drupal SMTP email module with Gmail alvin February 10, 2019 - 1:45pm

As a brief note to self, when you want to use the Drupal SMTP module with a Gmail SMTP server, such as for a Drupal contact form, the process goes something like this:

Getting the Drupal 8 Metatag module to show a canonical HTTPS URL alvin October 13, 2018 - 5:29pm

As a brief note, this website currently uses Drupal 8 and I was having a problem where the Metatag module was showing a canonical tag that began with http rather than https, which this website uses. The rest of this article briefly shows how I was able to fix this problem.

Dries Buytaert: “Mollom: The story of my first SaaS startup” alvin May 3, 2018 - 1:01pm

Dries Buytaert has a good story about how he created the now-defunct Mollom anti-spam service. No word on why they didn’t try to sell the service rather than just shut it down.

Best thing I’ve done to eliminate comments spam in Drupal 8 alvin May 1, 2018 - 7:43pm

After trying a lot of different anti-spam modules with Drupal 8, the best thing I’ve ever done to reduce comment spam is to go to the Drupal admin /admin/structure/types/manage/blog/fields URI, click Edit on the Comments field, and then select the “Anonymous posters may not enter their contact information.” Since I chose that option two days ago I’ve only had one spammy comment show up in my approval list. That field gave spammers a simple way to enter a URL, and without it, the spam seems to have dried up.

How to install and remove Drupal 8 modules at the command line with Composer

I find Drupal 8 module management to be confusing, but one thing I’ve learned is that you can install and remove Drupal 8 modules with Composer at the command line.

Adding a Drupal 8 module with Composer

The short story is that to add a new module — such as the reCAPTCHA anti-spam module — you type this command at the command line (in the root directory of your Drupal 8 website) to install it:

How to update a Drupal 7 website with Drush (notes) alvin April 22, 2018 - 6:03pm

As a brief “note to self,” this is how I just updated a Drupal 7 website using Drush. Please note that the output of some of the commands below refer to early versions of Drupal 8, but these commands also work with Drupal 7.

First, do these things: