This post is about Drupal 7 – Learn how to add CSS classes to blocks in Drupal 8.
alert()statements throughout your code. We now have inspectors, debuggers, and other tools that make things much easier. And you've probably encountered
console.logand the power of JS consoles. This can provide some good insight into what's going on with your code, but there is a catch.
I recently migrated content from a Drupal 7 site to a new Drupal 8 install using core’s Migrate, Migrate Drupal and Migrate Drupal UI modules. A few months after the initial migration, I decided to enable core Content Moderation for use with one of my migrated content types. No beuno.
Just saving any content for which I had enabled Content Moderation resulted in this tasteless error:
Implementing any type of modular CSS requires fine grain control over classes in your HTML. In my last post, we looked at how we can easily add classes to blocks in Drupal using preprocess functions. Now let's apply the same technique to fields. Fields are a fundamental building block of any Drupal 7 site. Fields contain content and content is king. Before we dig in and start classing up our fields, let's look at how they are rendered to the screen.