Text Blocks

Define named blocks in textarea fields and reuse them in other textarea fields.

ProcessWire Text Blocks Textformatter

This module enables you to assign a name to any block/region of text in a Textarea field. They are defined by typing start_name where you want the block to start, and stop_name where you want the block to stop. The block(s) of text can then be shown in any other Textarea field at runtime (site-wide) simply by typing the block name on its own line in the format show_name. Note that the word "name" in all of these examples would be wahtever you've decided to name the block.

Released in 2017 as part of ProFields and released open source in 2024.
License: MPL 2.0

Introduction


For a full introduction to this module, use cases and examples, please see: https://processwire.com/blog/posts/text-blocks/

How to install and use


Install

  1. Copy all the files in this directory to: /site/modules/TextformatterTextBlocks/

  2. In your admin, go to Modules > Refresh.

  3. Click the "Install" button next to Text Blocks.

  4. Determine which Textarea fields you want Text Blocks to be supported. Locate those fields in Setup > Fields and edit them. The most likely scenario is that you would apply it to your "body" field. When editing your field, go to the "Details" tab and select "Text Blocks" from the "Text formatters" select box. Save.

Test it out to make sure it is working

Edit any page that has a field using the Text Blocks text formatter. Define a block like this:

start_hello

Hello World!

stop_hello

Now go and edit another page that also has this field, and enter the following somewhere in the text:

show_hello

When viewing the page, you should see the "Hello World!" text.

More modules by Ryan Cramer

  • Hanna Code

    Easily insert any complex HTML, Javascript or PHP output in your ProcessWire content by creating your own Hanna code tags.
  • Form Builder PRO

    Building front-end forms on your website has never been so simple. ProcessWire Form Builder lets you create, edit and publish forms with no development necessary.
  • ProCache PRO

    ProCache provides the ultimate performance for your website by completely bypassing PHP and MySQL and enabling your web server to deliver pages of your ProcessWire site as if they were static HTML…
  • ProcessWire Upgrade

    Tool that helps you identify and install core and module upgrades.
  • Site Profile Exporter

    Enables exporting of ProcessWire site profiles for sharing or distribution with others.
  • Map Marker (Google Maps)

    This Fieldtype for ProcessWire 2.1+ holds an address or location name, and automatically geocodes the address to latitude/longitude using Google Maps API.
  • Video embed for YouTube/Vimeo

    Enables translation of YouTube or Vimeo URLs to full embed codes, resulting in a viewable video in textarea fields you apply it to. Now with support for responsive videos too.
  • Import Pages from CSV files

    Enables you to import CSV files to create pages.
  • Database Backups

    Create and/or restore database backups from the ProcessWire admin.

All modules by Ryan Cramer

Install and use modules at your own risk. Always have a site and database backup before installing new modules.