Drupal is a registered trademark of Dries Buytaert

twig_placeholders

8 sites Security covered
View on drupal.org

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.

Activity

Total releases
12
First release
Mar 2025
Latest release
10 months ago
Release cadence
2 days
Stability
17% stable

Release Timeline

Releases

Version Type Release date
1.0.1 Stable Apr 20, 2025
1.0.0 Stable Apr 7, 2025
1.0.0-alpha9 Pre-release Apr 4, 2025
1.0.0-alpha8 Pre-release Apr 2, 2025
1.0.0-alpha7 Pre-release Apr 2, 2025
1.0.x-dev Dev Apr 2, 2025
1.0.0-alpha6 Pre-release Apr 1, 2025
1.0.0-alpha5 Pre-release Apr 1, 2025
1.0.0-alpha4 Pre-release Apr 1, 2025
1.0.0-alpha3 Pre-release Mar 31, 2025
1.0.0-alpha2 Pre-release Mar 28, 2025
1.0.0-alpha1 Pre-release Mar 28, 2025