WinterCMS Plugin that replaces the "Preview" button for static pages with a real time preview of a page.
  • JavaScript 56.2%
  • PHP 31.8%
  • CSS 7.3%
  • HTML 4.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-12-29 14:54:12 +01:00
assets fixes blog posts preview 2025-04-12 22:42:50 +02:00
classes fixes static pages not updating in preview 2025-04-04 11:07:38 +02:00
http allows | in model class names for model preview url 2025-12-29 13:45:42 +00:00
lang adds close preview button 2024-04-24 13:45:19 +02:00
models WIP: preview for blog posts 2023-01-09 12:02:29 +01:00
partials uses '|' for class names in model preview 2025-12-29 14:54:12 +01:00
traits adds previewable trait 2022-12-14 12:24:58 +01:00
updates v1.1.5 2024-08-26 12:11:17 +02:00
.gitignore initial commit working prototype 2021-04-29 20:46:47 +02:00
composer.json adds requirements 2021-06-29 19:48:20 +02:00
Plugin.php adds inline editing in preview 2024-08-26 12:09:22 +02:00
README.md adds info about how to add preview button 2022-12-14 11:41:12 +01:00
routes.php allows to preview any model update form 2022-07-18 16:28:49 +02:00

Page Preview Plugin

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.