PHPackages                             gorriecoe/silverstripe-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. gorriecoe/silverstripe-preview

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

gorriecoe/silverstripe-preview
==============================

Adds a preview options to a Dataobject.

1209PHP

Since Jun 19Pushed 7y ago2 watchersCompare

[ Source](https://github.com/gorriecoe/silverstripe-preview)[ Packagist](https://packagist.org/packages/gorriecoe/silverstripe-preview)[ RSS](/packages/gorriecoe-silverstripe-preview/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Silverstripe preview
====================

[](#silverstripe-preview)

Adds preview options to a Dataobject or SiteTree. Basically provides more advanced options to summary content.

Installation
------------

[](#installation)

Composer is the recommended way of installing SilverStripe modules.

```
composer require gorriecoe/silverstripe-preview

```

Requirements
------------

[](#requirements)

- silverstripe/cms ^4.0

Suggestion
----------

[](#suggestion)

- [silverstripe/silverstripe-action](https://github.com/gorriecoe/silverstripe-action)

Maintainers
-----------

[](#maintainers)

- [Gorrie Coe](https://github.com/gorriecoe)

Usage
-----

[](#usage)

Adding preview to a DataObject

```
MyDataObject:
  extensions:
    - gorriecoe\Preview\Extensions\Previewable
```

Note that Previewable automatically extends SiteTree

### Default preview fields

[](#default-preview-fields)

Adding default fields to a DataObject or SiteTree

```
SilverStripe\CMS\Model\SiteTree:
  extensions:
    - gorriecoe\Preview\Extensions\PreviewDefaultFields
```

This will add Image, Title, Content and Label fields to a summary tab.

### Defining your own preview data

[](#defining-your-own-preview-data)

By default preview data will inherit from the DataObject. For example `$MyDataObject.Preview.Image` will use `$MyDataObject.Image`. However if you want the preview image to have fallback options, you can define it in your DataObject with the following static variable define.

```
class MyDataObject extends DataObject
{
    private static $has_one = [
        'PreviewImage' => Image::class,
        'HeaderImage' => Image::class
    ];

    private static $preview_data = [
        'Image' => [
            'PreviewImage',
            'HeaderImage'
        ]
    ];
}
```

In the example above `$MyDataObject.Preview.Image` will return the Image from `PreviewImage` first, if that doesn't exist then return `HeaderImage` and finally if that doesn't exist then return null.

### Template

[](#template)

Access preview data via template simply change the scope of the data using one of the following methods.

```

        {$Preview.Title}

```

```

            {$Title}

```

### Advanced Usage

[](#advanced-usage)

Check out [silverstripe/silverstripe-action](https://github.com/gorriecoe/silverstripe-action) code for an example of advanced usage. In it you will see you can prepend additional fallback options from another dataobject.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0536f68573a498329010867c6f5521f899c2294d5f599d77c8b226d68e74623d?d=identicon)[gorriecoe](/maintainers/gorriecoe)

---

Top Contributors

[![gorriecoe](https://avatars.githubusercontent.com/u/11811440?v=4)](https://github.com/gorriecoe "gorriecoe (20 commits)")

### Embed Badge

![Health badge](/badges/gorriecoe-silverstripe-preview/health.svg)

```
[![Health](https://phpackages.com/badges/gorriecoe-silverstripe-preview/health.svg)](https://phpackages.com/packages/gorriecoe-silverstripe-preview)
```

###  Alternatives

[shipmonk/name-collision-detector

Simple tool to find ambiguous classes or any other name duplicates within your project.

362.1M34](/packages/shipmonk-name-collision-detector)[bostondv/bootstrap-ninja-forms

Adds Bootstrap classes to Ninja Forms

222.2k](/packages/bostondv-bootstrap-ninja-forms)

PHPackages © 2026

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