twig_placeholders
The Twig Placeholders module provides a simple and flexible way to generate placeholder content directly within Twig templates.
It allows developers to insert placeholder lorem ipsum text, images, logos, videos, menu data, form select data, table data and other mock content.
This module is designed for Drupal 10.3+ and is ideal for theme developers, frontend engineers, and anyone needing quick, dynamic placeholders in their templates.
Main features / functionalities:
-
✅ Generate placeholder lorem ipsum text
using a simple Twig function.
-
✅ Generate placeholder images
from Lorem Picsum with customisable attributes.
-
✅ Generate placeholder logos
from Logo Ipsum with customisable attributes.
-
✅ Generate placeholder videos
from Test Videos with customisable attributes.
-
✅ Generate placeholder menu data
in the same structure as a Drupal menus with optional minimum and maximum number of items, children, grandchildren etc.
-
✅ Generate placeholder select data
in the same structure as a Drupal
<select>list with optional number of<option>and<optgroup>items. -
✅ Generate placeholder table data
in the same structure as a Drupal
<table>templates expect with optional number of rows<tr>and columns<td>as well as options to include/exclude a header row<tr><th>...</th><th>...</th>...</tr>or specify all table data items as either<td>or<th>elements. -
⚙️ Fully configurable
via Twig function arguments.
-
🎨 Designed for Theming & Prototyping
by allowing mock content within Twig templates.
Post-Installation
No additional configuration is required.
You can immediately use the following Twig functions in your templates:
{{ tp_lorem_ipsum() }} will generate 50 words of lorem ipsum text.
{{ tp_image() }} will generate a placeholder image.
{{ tp_logo() }} will generate a placeholder logo.
{{ tp_video() }} will generate a placeholder video.
{{ tp_menu_data() }} will generate an array of menu items you can iterate through in your menu components.
{{ tp_select_data() }} will generate an array of select options you can iterate through in your <select> component.
{{ tp_table_data() }} will generate an array of table data you can iterate through in your <table> component.
See the README.md on GitLab for full usage instructions.
Additional Requirements
This module has no external dependencies beyond Drupal Core.
Similar projects
-
Lorem Ipsum module: provides dummy text but does not integrate directly with Twig templates.
-
Dummy Image module: generates placeholder images but for the use case where a local environment cannot access the files on the production server or pull those files to be served locally and does not integrate directly with Twig templates.
-
Realistic Dummy Content module: generates realistic dummy content but integrates with Devel generate and does not integrate directly with Twig templates.
-
Faker module: generates realistic dummy content but integrates with Devel generate and does not integrate directly with Twig templates and did not have a Drupal 11 release at the time that this module was created.
Community Documentation
Once initial release is ready I will provide a YouTube walkthrough of all the functionality this module provides!
Supporting organisation
Pivale are a globally trusted web development company who build Drupal CMS websites and software.