studiobosco/wn-pagepreview-plugin

WinterCMS Page Preview Plugin

Installs: 711

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:winter-plugin

v1.1.5 2024-08-26 12:11 UTC

This package is not auto-updated.

Last update: 2024-12-19 08:57:00 UTC


README

WinterCMS Plugin that replaces the "Preview" button for static pages, mail templates and other model forms with a real time preview.

After installing go to Settings > Page Preview and enable what you need. Then click the "Preview" button in the edit form.

Adding preview for model update forms

To create a preview button for a model you must first register the model form controller and the model class:

\StudioBosco\PagePreview\Classes\PreviewManager::registerPreview($controllerClass, $modelClass);

Then you must add a "preview" method to the model:

public function preview()
{
    return 'this is the preview';
}

Optionally you can add the preview button to the model fields:

fields:
    preview_button:
        type: partial
        path: $/studiobosco/pagepreview/partials/_model_preview_button.htm

If you do not add it the plugin will add it automatically, but eventually in the wrong position.