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.
The things people do with Raspberry Pi computers are amazing. This photo shows a cluster of RPI computers someone put together to run Drupal. At some point I hope to put together a similar cluster to run things like Akka and Apache Spark.
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. :)
Tips on performance optimization for Drupal websites.