Drupal 8: How to write a simple custom “block module”
Table of Contents
- Goals
- 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
- 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.
Best practices for software development (continuous integration)
This Wikipedia page on continuous integration is actually a good resource for computer programming best practices.
Functional Programming, Simplified
I’m pleased to announce that my book, Functional Programming, Simplified, is now available in three formats:
PDF Format |
Paperback Book |
Kindle eBook |
As I wrote in Functional Programming, Simplified, functional programming can lead to happiness (and sanity). The quotes in this slide from Rúnar Bjarnason’s FP talk expand on what I wrote in my book. They keys are that pure functions are very simple, and you don’t have to constantly worry about the mutable state in your application.
A nice story about Lisp
twobithistory.org has a nice story about Lisp titled, How Lisp became God’s own programming language. That page links to Paul Graham’s old Beating the averages post where he shares this Eric Raymond quote: “Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot.”
From this AirBnB article about using React Native: “JavaScript is an untyped language. The lack of type safety was both difficult to scale and became a point of contention for mobile engineers used to typed languages who may have otherwise been interested in learning React Native ... A side-effect of JavaScript being untyped is that refactoring was extremely difficult and error-prone.”
The 90/90 Rule of software development
The 90/90 Rule: “The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.”
~ Tom Cargill
Shared state in functional programming
typelevel.org has a nice article on shared state in functional programming.
I was reminded of this “If at first you don’t succeed, call it Version 1.0” saying this morning. You can find this t-shirt on Amazon if you’re interested.
Listening and trust (and developing open source software)
Based on his current work in developing Rust, Aaron Turon has a couple of good blog posts on developing/leading open source projects titled, listening and trust, part1, and listening and trust, part 2.