Creating links to ECK Entities in Twig

This post is mostly so I don't forget, as it took several hours to figure out.

Recently, I needed to create some links in a twig templates to various ECK ( Entity Construction Kit ) entity types, mostly to Add, View, and Edit.  Now, it's not really a good idea to try building the paths manually, since the paths may change ( if I update the pathauto patterns or something ).  Routes are much more stable.

In Twig, there are two main functions for generating links, link() and path().  Link creates an absolute URL, while path ( wait for it ) creates a path or relative URL.

Component Driven Drupal Theming

When designing a Drupal based site, there is a killer tool with which most of us are familiar, Paragraphs.  Paragraphs allows us to create a component-based architecture, whereby authors can add components to a page in a structured way.  How can we use the flexibility of Paragraphs to create a component-driven author experience that empowers the author while ensuring a consistent design language?

Stuff Used In This Post:

Subscribe to Drupal