TextformatterMultiValue by rolandtoth

Allows setting key = value pairs in a textarea or text field to use as variable groups in templates.

MultiValue Textformatter for ProcessWire

Set flexible data structures in "key = value1, value2, ..." format to use as variable groups in templates.

Great for general site settings, social links, menus, or just grouping items together without creating separate fields.


  • create groups of variables using only a single textarea/text field
  • easy value retrieval
  • (optional) row headers
  • scalability: add as many rows and items as you need, or change their order
  • fallback to original field value
  • multilanguage ready through FieldtypeTextLanguage and FieldtypeTextareaLanguage field types


  1. Copy module files to "/site/modules/TextformatterMultiValue/" directory
  2. Go to Modules in the admin, Refresh and Install the module "MultiValue Textformatter"
  3. Create a field of type FieldtypeTextarea or FieldtypeText
  4. Apply "MultiValue Textformatter" textformatter on the field's "Details" tab
  5. Enter rows with keys and items (see syntax below)



Rows consists of a "row key" (optional) and item(s). The key separator is the " = " and the items separator is ":::". Note: from version 1.3.1 the spaces in the key separator are mandatory.

Row key = Some value ::: Another value ::: Yet another value

Row key can be any string, it will be converted to lowercase and sanitized. For example the key "Row key" will be converted to "row_key". This key will be used for retrieval in template files.

No keys mode

Keys can be optionally left out which allows setting items simply by listing them:


Retrieval for the above:

foreach($page->video_links as $video_link) {
    echo '<iframe src="' . $video_link . '"></iframe>';

Row header

If the first line begins with the "@" character it indicates it contains row headers.

@ url ::: title ::: target
Facebook = https://facebook.com/mycompany ::: Follow us on Facebook ::: _blank
Linkedin = https://www.linkedin.com/mycompany ::: NULL ::: _blank
Email = #contact ::: Contact

Row headers are optional but thely will help you retrieving items. For example, to get the "title" item, use this:

echo $page->my_field->facebook->title
// result: "Follow us on Facebook"

echo $page->my_field->email->title
// result: "Contact"

If row headers are missing you can get the items using "valueX", where "X" is the index of the item (zero-based!):

echo $page->my_field->facebook->value1
// result: "Follow us on Facebook"

Number and order of items

You can use any number of items in a row, and rows doesn't need to contain the same number of items. However, the order of the item is important, so if an item is not needed, substitute it with the "NULL" placeholder value:

@ url ::: title ::: target
Linkedin = https://www.linkedin.com/mycompany ::: NULL ::: _blank

In the example above "$page->my_field->linkedin->title" will be an empty string.


  • when no key is set the unmodified field value is returned ($page->field)
  • get the number of rows using "$page->field->count"
  • get the number of items using "$page->field->key->count"
  • check if a key name is available using "$page->field->hasName"


Use "//" to comment out items.

// Info = this row will be skipped.

Cheat sheet

$page->field->key            // item value
$page->field->key->value     // item value
$page->field->key->value2    // third item value (if no headers set, value0, value1, ...)
$page->field->key->name      // human readable key name
$page->field->key->count     // number of row items
$page->field                 // original field value (no modification)
$page->field->count          // number of field rows
$page->field->hasName        // true if key name is set, false if not
$page->field->original       // original field value (no modification)


Licensed under the MIT license.

MultiValue textformatter is provided "as-is" without warranty of any kind, express, implied or otherwise, including without limitation, any warranty of merchantability or fitness for a particular purpose. In no event shall the author of this software be held liable for data loss, damages, loss of profits or any other kind of loss while using or misusing this software.

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

Twitter updates

  • ProcessWire 3.0.192 (dev branch) contains 11 issue fixes and 5 pull requests, over 20 commits— More
    7 January 2022
  • ProcessWire 3.0.191 core updates: updates to the installer and the profile exporter module— More
    24 December 2021
  • This week ProcessWire went on a diet, trimming the core size from 15.5 MB down to 7.5 MB by moving optional site profiles into their own GitHub repos— More
    17 December 2021

Latest news

  • ProcessWire Weekly #401
    In the 401st issue of ProcessWire Weekly we'll cover the latest core updates, check out a brand new module called Lister Native Date Format, and more. Read on!
    Weekly.pw / 15 January 2022
  • ProcessWire 3.0.190 core updates
    ProcessWire 3.0.190 has 15 commits relative to 3.0.189 and contains a mixture of issue resolutions and feature additions. This post covers them all, in addition to updates for the PageAutosave and ProFields Table modules.
    Blog / 3 December 2021
  • Subscribe to weekly ProcessWire news

“I am currently managing a ProcessWire site with 2 million+ pages. It’s admirably fast, and much, much faster than any other CMS we tested.” —Nickie, Web developer