Blog

Fresh off the Blog

Unmanaged Files - Part 5

Tutorial

Part 5: Enhancing the Twig Function for Unmanaged Files

In Part 4, we rendered unmanaged files through a Twig template defined in the module. In this part, we’ll expand that flexibility by upgrading the Twig function introduced earlier so that theme authors can decide whether they want a URL or a fully rendered image tag—right from Twig.

Unmanaged Files - Part 4

Tutorial

Part 4: Using a Twig Template to Render Unmanaged Files

In Part 3 we exposed the file handler through a Block Plugin, letting site builders drop the output into regions via the UI. That works great for flexibility, but sometimes you want tighter control: a fixed piece of markup directly in a page template, not dependent on the block system at all.

Above Ground - Vol 1 Issue 5

Unmanaged Files - Part 3

Tutorial

Part 3: Rendering an Unmanaged File in a Block

In Part 2, we built a service that can locate unmanaged files and return one at random. In this part, we’ll expose that functionality as a block plugin. Blocks are a powerful way to make custom logic reusable: site builders can place them anywhere through the Drupal block layout interface, no code changes required.

Unmanaged Files - Part 2

Tutorial
In Part 1 of this series we set the stage for using unmanaged files—assets Drupal doesn’t track as entities—to keep certain use cases simple. In Part 2 we’ll write a small Drupal service that scans a folder tree of images and returns one random file. No categories or constraints yet, that comes later—just proof that Drupal can “see” and use files, living in public://, private://, or even a directory outside the web root, without managing them.