Skip to content
No description, website, or topics provided.
PHP JavaScript CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples rename rockmarkup to rockmarkup2 Aug 14, 2019
lib init Jul 10, 2019
snippets
views rename RockMarkup to RockMarkup2 Aug 14, 2019
FieldtypeRockMarkup2.module.php rename RockMarkup to RockMarkup2 Aug 14, 2019
InputfieldRockMarkup2.module.php rename RockMarkup to RockMarkup2 Aug 14, 2019
LICENSE init Jul 10, 2019
ProcessRockMarkup2.css rename RockMarkup to RockMarkup2 Aug 14, 2019
ProcessRockMarkup2.module.php rename rockmarkup to rockmarkup2 Aug 14, 2019
README.md rename rockmarkup to rockmarkup2 Aug 14, 2019
RockMarkup2.js rename RockMarkup to RockMarkup2 Aug 14, 2019
RockMarkup2.module.php rename rockmarkup to rockmarkup2 Aug 14, 2019
RockMarkup2File.php rename RockMarkup to RockMarkup2 Aug 14, 2019
RockSandbox.css refactoring Jul 11, 2019
RockSandbox.js

README.md

RockMarkup2

This is a ProcessWire module that helps you injecting any custom PHP/JS/CSS code into the PW admin as Inputfields. It comes with a ProcessModule (sandbox) to easily create, test and edit your fields. This sandbox module will only work on Uikit based admin themes.

Installation

All you need to do is to install the main module. All necessary sub-modules will be installed automatically.

Support, Feedback

If you need any assistance or want to provide feedback, please head over to the PW Support Forum thread.

Usage

After installation head over to the newly created page under /setup and create new files or see the examples:

img

It is very easy to create new fields/files via the admin interface. Just click the links and see the examples of how to use the module.

Show a field in the page editor

You can add your markup to any page editor by creating a new PW field of type RockMarkup2 and adding it to your page's template.

There is a helper on the details page of each example:

img

Show a field in a ProcessModule

It is also very easy to use this Inputfield in your ProcessModules:

public function ___execute() {
  /** @var InputfieldForm $form */
  $form = $this->modules->get('InputfieldForm');

  $form->add([
    'name' => 'yourfieldname',
    'type' => 'RockMarkup2',
  ]);

  return $form->render();
}

All the configuration and logic will be done in the field's related files. You can see /setup/rockmarkup2/process-example in your PW installation as an example.

Adding dirs via hook

You can create custom modules based on RockMarkup2. To add your module's directory to RockMarkup2 you need to modify the getDirs() return array in your module's init() method, otherwise the files will never be scanned and executed:

$this->addHookAfter("RockMarkup2::getDirs", function(HookEvent $event) {
  $dirs = $event->return;
  $dirs[] = '/site/modules/MyModule/RockMarkup2/';
  $event->return = $dirs;
});

Misc

Hide the label of a field

By default the Inputfield will render the field's name if no label is set. You can hide the label via the hideLabel property:

$form->add([
  'name' => 'mymarkup',
  'type' => 'RockMarkup2',
  'hideLabel' => true,
]);
You can’t perform that action at this time.