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

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

arillo/silverstripe-dataobject-preview
======================================

Shows a preview of your dataobjects like the one you get for pages.

2.0.2(5y ago)48.8k↓50%3[2 issues](https://github.com/arillo/silverstripe-dataobject-preview/issues)MITPHPCI failing

Since Oct 13Pushed 2mo ago7 watchersCompare

[ Source](https://github.com/arillo/silverstripe-dataobject-preview)[ Packagist](https://packagist.org/packages/arillo/silverstripe-dataobject-preview)[ Docs](https://github.com/arillo/silverstripe-dataobject-preview)[ RSS](/packages/arillo-silverstripe-dataobject-preview/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (14)Used By (0)

Dataobject preview
==================

[](#dataobject-preview)

[![Latest Stable Version](https://camo.githubusercontent.com/dfa7a621f4914320e472e07928cd01c0a7e64f1a26fb3368de06dff5b7035c27/68747470733a2f2f706f7365722e707567782e6f72672f6172696c6c6f2f73696c7665727374726970652d646174616f626a6563742d707265766965772f762f737461626c653f666f726d61743d666c6174)](https://packagist.org/packages/arillo/silverstripe-dataobject-preview)[![Total Downloads](https://camo.githubusercontent.com/9cccfa7668a9b250503c2fb9e82195e6aae74ba7535a10b3d52ddd1bbaec48ce/68747470733a2f2f706f7365722e707567782e6f72672f6172696c6c6f2f73696c7665727374726970652d646174616f626a6563742d707265766965772f646f776e6c6f6164733f666f726d61743d666c6174)](https://packagist.org/packages/arillo/silverstripe-dataobject-preview)

Shows a preview of your dataobjects like the one you get for pages. Works for GridField and ModelAdmin. Works only for Versioned DataObjects.

For the preview to work you need to implement the CMSPreviewable interface on your DataObject and declare the methods getMimeType, CMSEditLink and PreviewLink($action = null).

You also will need to declare the stages this DataObject should show in the preview pane by setting the appropiate static variables to true.

PreviewLink is the only link we are interested for the preview to work. The DataObjectPreviewController will listen for this links to render your MyDataObject with the MyDataObject.ss template in your theme/templates/\* folder.

Since activating this feature is a bit hacky, we need to also define a custom template for our CustomModelAdmin.

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

[](#requirements)

SilverStripe CMS ^4.0

For a SilverStripe 3.x compatible version of this module, please see the [1 branch, or 1.x release line](https://github.com/arillo/silverstripe-arbitrarysettings/tree/1.0).

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

[](#installation)

```
composer require arillo/silverstripe-dataobject-preview:2.0.*

```

Example
-------

[](#example)

```
