PHPackages                             toastnz/open-cms-preview - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. toastnz/open-cms-preview

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

toastnz/open-cms-preview
========================

Force SilverStripe to open the CMS preview panel on any page with a form

0.2.2(3mo ago)02.1k↑116.7%1BSD-3-ClauseJavaScriptPHP &gt;=8.3

Since Mar 5Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/toastnz/silverstripe-open-cms-preview)[ Packagist](https://packagist.org/packages/toastnz/open-cms-preview)[ RSS](/packages/toastnz-open-cms-preview/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (17)Used By (1)

Open CMS Preview Module
=======================

[](#open-cms-preview-module)

This module allows you to open the CMS preview panel from any page in the CMS that has a form.

### Installation

[](#installation)

To install the module, use Composer:

```
composer require toastnz/open-cms-preview
```

### Usage

[](#usage)

To use the module, simply add the following form field to any form in the CMS:

```
use Toast\OpenCmsPreview\Fields\OpenCmsPreview;

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    $fields->addFieldsToTab('Root.Main', [
        OpenCmsPreview::create($this->getPreviewLink());
    ]);

    return $fields;
}

public function getPreviewLink()
{
    // Return the link to the page you want to preview
}
```

### Extending the controller

[](#extending-the-controller)

The module adds a new OpenCMSPreviewController to the window which you can extend to add custom functionality.

The refresh event is called when the Controller observes an ajax / fetch event with some basic and conditional checks to determine when the refresh should be called or prevented. You can use the on('beforeRefresh') event to add custom functionality before the refresh is called.

Additionally you can call event.preventRefresh(); to prevent the refresh from being called.

```
// Example usage
window.OpenCMSPreviewController.on('beforeRefresh', (event) => {
    // This event data also includes the ajax / fetch response
    console.log(event.data);

    // Prevent the refresh from being called if some condition is met
    if (event.data.someKey == 'someValue') {
        event.preventRefresh();
    }
});
```

You also have access to a few other events:

```
// When the refresh is complete
on('refresh', (iframeSrc) => {});

// Before the preview refresh script has run
on('beforeRefresh', (event) => {});

// After the preview has been added to the page
on('addPreview', (previewElement) => {});

// After the preview has been removed from the page
on('removePreview', () => {});
```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance81

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Recently: every ~78 days

Total

16

Last Release

102d ago

Major Versions

0.0.10 → 6.0.0-beta12025-03-27

PHP version history (2 changes)0.0.0PHP &gt;=8.1

6.0.0-beta1PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/9cc41858b7e0e95f7c9ff396fc2d454339424c425d8f78aeb526434da6f61543?d=identicon)[priscilla-toastnz](/maintainers/priscilla-toastnz)

---

Top Contributors

[![emmanuel-toast](https://avatars.githubusercontent.com/u/44280336?v=4)](https://github.com/emmanuel-toast "emmanuel-toast (23 commits)")[![pyap22](https://avatars.githubusercontent.com/u/20524832?v=4)](https://github.com/pyap22 "pyap22 (1 commits)")

---

Tags

silverstripemodularpreviews

### Embed Badge

![Health badge](/badges/toastnz-open-cms-preview/health.svg)

```
[![Health](https://phpackages.com/badges/toastnz-open-cms-preview/health.svg)](https://phpackages.com/packages/toastnz-open-cms-preview)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
