processwire / processwire-requests

ProcessWire feature requests.
39 stars 0 forks source link

Add readme of module to module config screen #399

Closed BernhardBaumrock closed 3 years ago

BernhardBaumrock commented 3 years ago

Short description of the enhancement

I'm building a module that is configured mostly via code in config files. That means it is a little less user friendly than having a UI. So I decided to add the module's readme instead of config fields to the module's config screen:

img

Adding the readme is very simple and can be done using PW core tools:

  /**
  * Config inputfields
  * @param InputfieldWrapper $inputfields
  */
  public function getModuleConfigInputfields($inputfields) {
    $readme = $this->wire->files->render(__DIR__."/README.md");
    $inputfields->add([
      'type' => 'markup',
      'label' => 'Readme',
      'icon' => 'life-ring',
      'collapsed' => Inputfield::collapsedYesAjax,
      'value' => $this->wire->sanitizer->entitiesMarkdown($readme, true),
    ]);
    return $inputfields;
  }

Why would the enhancement be useful to users?

As this is really easy to do and turned out to be very helpful I thought: Why not add the readme of the module by default if one exists?

jmartsch commented 3 years ago

Great idea.

adrianbj commented 3 years ago

@BernhardBaumrock - have you used @netcarver 's ModuleReleaseNotes ? It adds that, as well as changelog and license files, all nicely collapsed under Support Files:

image

jmartsch commented 3 years ago

@BernhardBaumrock - have you used @netcarver 's ModuleReleaseNotes ? It adds that, as well as changelog and license files, all nicely collapsed under Support Files:

image

Yeah, I remembered that also.

BernhardBaumrock commented 3 years ago

Thx adrian, totally forgot about that module :)