Jump to main content Jump to doc navigation

modval is an Output Modifier that accepts a numeric value and modifies it, like the built-in Output Modifers 'add', 'subtract', 'multiply' and 'divide'. However modval adds one more detail in that it removes any characters that aren't numeric, then adds them back in after the value is modified.

Examples:

[[modval?input=`4px`&options=`*3`]]

Results: '12px'

[[+line_height:modval=`/2`]]

Where the value of the placeholder is '1.8em'

Results: '.9em'

Note: modval currently doesn't support complex unit combinations like '8lbs 4 oz.' It's really meant for simple CSS unit/value pairs. 'rgba('255','255','255',.75)' is another example of a string that modval canNOT process.

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • eydolan
  • Lefthandmedia
  • Murray Wood
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$306 per month—let's make that $500!

Learn more