GetPublii/Publii

[Feature Request]: Additional Developer Documentation for Plugin Development

bjazmoore opened this issue · 1 comments

Feature Description

I know that some documentation exists (thank you so very much Tom!), but there are still things that need some explanation. Specifically I wanted to understand the following (which is hinted at in the docs but not explained):

I would like to know how validation and error messaging works when creating a plugin. How can I communicate back to the user that a validation of their input in a plugin failed. I have the following test code, but I lack documentation on this functionality. Any assistance would be awesome. This is what I tried. I am hoping it is close, but I know it does not work.

validateRules() {
    let valid = true;
    this.errorMessages = []; // Reset previous errors

/* testing */

    valid = false;
    this.errorMessages.push(`There is an Error!`);
  });

  return valid;

Also - while we are on the subject - how can I echo back a value being manipulated before saving a config in the this.API.saveConfig(this.config);. I tried console.log(), but it does not seem to be accessible. Thanks.

Bump. Anyone else think this would be a great thing to have?