Tips on performance optimization for Drupal websites.
recent posts related to the drupal content management system
Table of Contents
- Backup your database
- Check my code out of Github, or create a module directory
- Create a project info YAML file
- Create the necessary subdirectories
- Write the code to display your block
- Clear the caches
- Enable the module
- Place the block module
- See the custom block on your website
- The biggest problem I encountered
- The source code
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.
This drupal.org page shows how to update Drupal 8 using drush and other techniques.
As a quick “note to self,” to get the Share Buttons module by AddToAny working in Drupal 8, I followed these steps:
- install the AddToAny module - configure permissions so i could work with it - admin/people/permissions - configure AddToAny as desired - admin/config/services/addtoany - create a block, add it to a region (such as Content) - i actually created a block, then modified my theme to show AddToAny between the Contents and the Comments
The key to getting AddToAny was knowing to go to admin/structure/block and then selecting “Place Block” to create an AddToAny block. Not knowing that I had to do that slowed me down for quite a while.
Earlier today I ran into a problem making a Drupal 8 database backup. I ran the usual mysqldump backup command, and when it kept running for a long time I decided to kill it, and then began investigating the problem. I knew that I had recently deleted all of the log records, and the Drupal
cron task was running correctly, so something else was going on. In short, I found that my Drupal 8 database was huge.
A nice thing about the CKEditor in Drupal 8 is that it’s easy to add your own custom styles to the CKEditor “Styles” drop-down menu. This is the menu in the CKEditor widget you see when you’re editing content at a URI such as node/add/blog, which I’m referring to in this image:
If you’re reading this, that means the DNS change for alvinalexander.com has propagated to your location. I just moved this website to a new server and the latest version of Drupal on June 18, 2016. If anything is wrong with it, well, that’s gonna be my fault. I’ll fix broken things as fast as I can. :)
“In Drupal 8, anonymous page caching is enabled by default. There is no option to turn it on or off.”
(Quote is from this pantheon.io article.)
Drupal alternatively makes me want to either jump for joy or jump off the balcony. Today was a balcony day.
Today’s issue is related to the handling of “tags” in Drupal 8, specifically the issue where you can’t add a new tag when editing a blog post, you can only reference existing tags. I have a degree in aerospace engineering, founded and sold a programming business, and can write software in many different languages, but a few things like this in Drupal make me feel like I need more of an education.