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.
Programming is an interesting profession. You fail dozens or hundreds of times a day, then take a moment to celebrate a little victory. Then you move on to your next failure/success.
Yesterday’s regex - Was I drunk, or a genius? From Geek & Poke’s cartoons.
“In reality, programming languages are how programmers express and communicate ideas — and the audience for those ideas is other programmers, not computers. The reason: the computer can take care of itself, but programmers are always working with other programmers, and poorly communicated ideas can cause expensive flops.”
~ Guido van Rossum, in this 2016 article
I just spent 45 minutes reading a new book about a programming language I was excited to learn, then slammed it shut and said, “Poorly organized, too many words, not enough code.”
That’s always such a disappointing feeling when you have that initial excitement about a programming language (or technology), and then a book is such a letdown. (I really hope people don’t view my books that way.)
I just started working with TypeScript, and here are some good links:
And an unrelated link on React:
Kent Beck has a good article on Medium titled, Programmer Test Principles.
I had never heard of the term “Yoda Conditions” until now, but I have seen them in some Java code where programmers put the constant first in an effort to avoid null pointer exceptions.