FieldtypeFunctional by Ryan Cramer

Define fields with functions in template files.

ProcessWire Functional Fields

The “Functional Fields” module lets you make text translatable in your template files, much in the same way that you do with multi-language support in ProcessWire.

When editing your site template files, you simply wrap the text you want to output in a function call. Hence the name “Functional”. By doing this, you make that apparently static text become dynamic text, editable in ProcessWire. Functional fields are ideal for text fields that you provide a default value for (in your template file) that the user can then change if they want to.

Example function calls used by Functional Fields:

__text('your text');
__textarea('your text');
__richtext('<p>your text</p>');

For more details, usage instructions, please see the Functional Fields post at: https://processwire.com/blog/posts/functional-fields/

How to install


  1. Copy all the files in this directory to /site/modules/FieldtypeFunctional/
  2. In your admin, go to Modules > Refresh.
  3. Click the "Install" button next to Fieldtype > Functional.
  4. Create a new field (Setup > Fields > Add), choose "Functional Fields" as type.

History


This module was part of the commercial ProFields set of modules between 2017 and 2024. In that time, this particular module has not required significant support resources so no longer needs to be part of ProFields. Plus, we want to make room for new ProFields, though this module is very much in keeping with the purpose of ProFields. If you find this module useful, please consider getting the full ProFields package, as we're sure you'll find it very useful as well. Commercial support for this module is also available in the ProFields support board for current subscribers.

More about ProFields: https://processwire.com/store/pro-fields/

License


In June 2024 Functional Fields was released open source under the MPL 2.0 license: https://processwire.com/about/license/mpl/

Copyright 2017-2024 by Ryan Cramer

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

Latest news

  • ProcessWire Weekly #547
    In the 547th issue of ProcessWire Weekly we're going to check out the latest core updates, introduce a couple of new modules, and more. Read on!
    Weekly.pw / 2 November 2024
  • Custom Fields Module
    This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
    Blog / 30 August 2024
  • Subscribe to weekly ProcessWire news

“Indeed, if ProcessWire can be considered as a CMS in its own right, it also offers all the advantages of a CMF (Content Management Framework). Unlike other solutions, the programmer is not forced to follow the proposed model and can integrate his/her ways of doing things.” —Guy Verville, Spiria Digital Inc.