RockCalculator by bernhard

Add a calculator to any Inputfield in the ProcessWire backend.

RockCalculator

Add a calculator to any Inputfield in the ProcessWire backend.

img

Setup


At the moment there is no UI for defining fields that should support the calculator. You have multiple options:

  1. Tracy Console
// show rockcalculator and round result to .00
$field = $fields->get('yourfieldname');
$field->set('rockcalculator', 2); // 2 digit precision
$field->save();
  1. RockMigrations
$rm->setFieldData('yourfield', ['rockcalculator' => 2]);
  1. Hook buildForm
$wire->addHookAfter("ProcessPageEdit::buildForm", function($event) {
  $form = $event->return;
  $page = $event->process->getPage(); // edited page
  if($page->template !== 'yourpagetemplate') return;
  if($f = $form->get('yourfield1')) $f->rockcalculator = 2;
  if($f = $form->get('yourfield2')) $f->rockcalculator = 2;
  if($f = $form->get('yourfield3')) $f->rockcalculator = 2;
});

License

See license of math.js here: https://github.com/josdejong/mathjs/blob/develop/LICENSE

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

Twitter updates

  • ProcessWire 3.0.182 core updates– More
    23 July 2021
  • ProcessWire 3.0.181 has fixes and improvements as usual, but the biggest addition is a nice pull request for multi-language module translations, plus major updates to our Helloworld and ProcessHello demonstration modules. This post covers it all— More
    2 July 2021
  • ProcessWire 3.0.180 core updates– More
    18 June 2021

Latest news

  • ProcessWire Weekly #377
    In the 377th issue of ProcessWire Weekly we'll cover the latest core updates, highlight some recent online resources, and more. Read on!
    Weekly.pw / 31 July 2021
  • ProcessWire 3.0.181 core updates + “Hello World”
    ProcessWire 3.0.181 has fixes and improvements as usual, but the biggest addition is a nice pull request from LostKobrakai, plus major updates to our Helloworld and ProcessHello demonstration modules. This post covers it all.
    Blog / 2 July 2021
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani