Article
Posted on 28th July 2020
Takes about 2 mins to read
This article is part of the series
Upgrading to Drupal 9

Many of us at ComputerMinds have always taken pride on doing Drupally things the right way whenever possible, and then helping the community do so too. One of these things is displaying values from fields on content entities. We wrote before about how to do this in Drupal 7 and Drupal 8. It's now the turn of Drupal 9! Thankfully, this updated version is basically the same as the last one, as D9 is very...

Article
Posted on 4th December 2018
Takes about 7 mins to read

Let me take you on a journey. We'll pass by Drupal content renderer services, AJAX commands, javascript libraries and a popular front-end framework. If you've only heard of one or two of those things, come lean on the experience I took diving deep into Drupal. I'm pleased with where my adventure took me to, and maybe what I learned will be useful to you too. Here's the end result: a contact form, launched from a...

Article
Posted on 10th April 2018
Takes about 5 mins to read

Once upon a time, we wrote an article about how to render fields on their own in Drupal 7, which was really handy because Drupal 7 wasn't always intuitive. It's common to want to display a field outside of the context of its main entity page, like showing author information in a sidebar block or in a panel, but you had to just know which functions to use. Drupal 8 came along since then using...

Article
Posted on 13th January 2014
Takes about 2 mins to read

Previously on this website I have written about rendering blocks programmatically and adding things to content to be managed alongside fields. It's time to combine the two! On many projects, we find ourselves needing to render a block consistently across all content of a certain type. For example: Are you trying to place advertising blocks or fixed javascript code between the fields in the content of a page, not just shoved into regions around the...

Article
Posted on 22nd March 2012
Takes about 1 min to read

This is a real quick one, but so useful! We often want to render a block within content, perhaps as part of a node (maybe in hook_node_view, and then made configurable like a field), but there's no obvious way to do this correctly for any block. Drupal normally renders its blocks per region, so there is no single function to embed a block. I came across this really simple solution by Damien Tournoud in a...

Article
Posted on 7th September 2011
Takes about 3 mins to read

Drupal 7 brought us Entities, and with them the powerful [Field API][] for 'storing, loading, editing, and rendering field data.' attached to them. If you're managing everything through 'manage fields' and 'manage display' tabs of your content type, then every part of that process is rather wonderfully taken care of for you. [Field API]: http://api.drupal.org/api/drupal/modules--field--field.module/group/field/7 We often, however, come across the need to render a field outside the context of it's entity. A common example might include rendering a node's author in a sidebar block. Sure, modules like Panels and CCK Blocks will do this for you, but doing it manually is actually not that hard.