Drupal: Hidden fields in programaticly defined entities

It can be useful to define custom entities programatically for streamlined CRUD webapps using Drupal. One nice thing about doing it this way is that you can keep all your entity definitions in the code, so deployment is easier - no clicking around on the various environments to keep things synced or akward db sync scripts. Sometimes a custom entity needs to have a hidden field that should not be exposed in the user-facing create/edit form....

June 13, 2024 · 2 min · 225 words · Ryan Dorward

Drupal: Image styles in Tokens

I was hitting a roadblock trying to get a sites metatags nice for social sharing, using the Metatags module. In the past I’ve written code to manually generate the meta tags, but thought this time around I would see if I could not reinvent the wheel. I started to regret my decision when it seemed like tokens for images don’t allow you to serve up derivative images using Image styles. This meant that the only option was to present the image that was uploaded in the raw form - not always what you want....

May 30, 2024 · 2 min · 301 words · Ryan Dorward