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
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Digital Penguin
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • Following Sea
  • Anton Tarasov
  • eydolan
  • Raffy
  • Lefthandmedia
  • Murray Wood
  • Snow Creative
  • Nick Clark
  • Helen
  • JT Skaggs
  • krisznet
  • YJ
  • Yanni
  • Richard

Budget

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

Learn more