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

  • New TinyMCE 6.2.0 Inputfield released for ProcessWire— More
    28 October 2022
  • This week we take a look at a new rich text editor for ProcessWire, why we chose it, some highlights, screenshots, and why we think you’ll like it— More
    21 October 2022
  • This week we have ProcessWire 3.0.206 on the dev branch and a new version of the ProDevTools UserActivity module, which we'll take a closer look at in this post— More
    7 October 2022

Latest news

  • ProcessWire Weekly #447
    In the 447th issue of ProcessWire Weekly we'll share the latest core updates, introduce a new third party module called RockVideoThumbnailGrabber, and more. Read on!
    Weekly.pw / 3 December 2022
  • New rich text editor for ProcessWire
    This week we take a look at a new rich text editor for ProcessWire, why we chose it, some highlights, screenshots, and why we think you’ll like it.
    Blog / 21 October 2022
  • Subscribe to weekly ProcessWire news

“Yesterday I sent the client a short documentation for their ProcessWire-powered website. Today all features already used with no questions. #cmsdoneright—Marc Hinse, Web designer/developer