Jump to content
bernhard

How to create a simple Runtime Inputfield

Recommended Posts

During testing of the https://processwire.com/talk/topic/22847-processwire-dashboard/ module I've created this simple demo inputfield to show how Inputfields can be used as presentation blocks in ProcessModules. The result is this little inputfield that shows the getting started chart of chartjs: https://www.chartjs.org/docs/latest/

 

https://github.com/BernhardBaumrock/InputfieldChartDemo

It comes with 2 ProcessModules

rwpSaPf.png

1) One single chart inputfield

W90EC8H.png

2) Grid Demo

XOnBJ8F.png

Creating an Inputfield is really nothing more than creating a module file having 3 methods:

<?php namespace ProcessWire;
class InputfieldChartDemo extends InputfieldMarkup {

  public static function getModuleInfo() { ... }

  public function ___render() { ... }
  
  public function ___processInput($input) {
    return false;
  }
}

Place this in /site/modules/YourModuleName, name the class exactly the same as your folder and you get an installable Inputfield that you can use everywhere in your admin and share across projects!

Creating a ProcessModule is also very simple (see this old post):

 

You do even need only 2 methods in this module!

<?php namespace ProcessWire;
class ProcessInputfieldChartDemo extends Process {
  public static function getModuleInfo() { ... }

  public function execute() { ... }
}

 

Using these internal tools it is really easy to create totally tailored user experiences for your clients in the PW backend!

  • Like 6

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...