RockCalculator (Archived)

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

More modules by bernhard

  • RockFinder

    Highly Efficient and Flexible SQL Finder Module
  • RockMigrations

    The Ultimate Automation and Deployment-Tool for ProcessWire
  • RockFrontend

    Module for easy frontend development
  • RockFinder3

    Combine the power of ProcessWire selectors and SQL.
  • RockLESS

    Module to parse LESS files via PHP.
  • Template Preview Images

    Show Preview Images for selectable Templates
  • RockMigrations1

    Module to handle Migrations inside your Modules easily.
  • RockHeadlineIDs

    Demo Textformatter
  • RockLite

    MailerLite Integration

All modules by bernhard

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