About MultiValue Textformatter

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

Category 1Admin Helpers
Admin helper modules are those that provide helpful tools, UI enhancements or optimizations to the admin panel (excluding Fieldtype or Inputfield modules).
Category 2Text Formatters
Textformatter modules that provide run-time formatting for blocks of text (typically used with Text/Textarea fields).
Release StateBeta
Close to stable, but users are advised to be cautious and test thoroughly.*
Module Version1.3.4
Class NameTextformatterMultiValue
Compatibility2.6, 2.7
Date AddedNovember 15, 2015
Last UpdatedMay 14, 2016
Recommended ByNew recommendations may take up to 1 day to appear.


This module's files should be placed in /site/modules/TextformatterMultiValue/
How to install or uninstall modules


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.