2017 © Pedro Peláez
 

silverstripe-module silverstripe-dataobjectpreview

Allows preview of dataobjects in GridField

image

heyday/silverstripe-dataobjectpreview

Allows preview of dataobjects in GridField

  • Thursday, May 3, 2018
  • by heyday
  • Repository
  • 24 Watchers
  • 9 Stars
  • 3,659 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 8 Versions
  • 3 % Grown

The README.md

SilverStripe DataObject Preview

Provides the ability to preview DataObjects in the CMS., (*1)

Installation (with composer)

$ composer require heyday/silverstripe-dataobjectpreview

Filesystem permissions

The cache/ directory in this module needs to be writable by PHP for DataObject Preview to work. Previews are rendered to file here to avoid repeated rendering of the same content., (*2)

When installing via Composer, you may want to add a post-install script in your project's composer.json to configure these permissions. For example:, (*3)

{
    // ...

    "scripts": {
        "post-install-cmd": [
            "chmod 777 silverstripe-dataobjectpreview/cache"
        ]
    }
}

Example

DataObject Preview Example, (*4)

Usage

DataObjects that you want to preview must implement, DataObjectPreviewInterface, which consists of one method getPreviewHtml., (*5)

This method getPreviewHtml must return a string., (*6)

getPreviewHtml, (*7)

public function getPreviewHtml()
{
    return "<html><body>Hello</body></html>";
}

DataObjectPreviewField

getCMSFields, (*8)


$fields->addFieldToTab( 'Root.Main', new DataObjectPreviewField( 'SomeDataObject', $this, new DataObjectPreviewer($generator) ) );

GridFieldDataObjectPreview

getCMSFields, (*9)

$fields->addFieldsToTab(
    'Root.Items',
    new GridField(
        'Items',
        'Items',
        $this->Items(),
        $config = GridFieldConfig_RelationEditor::create()
    )
);

$config->addComponent(
    new GridFieldDataObjectPreview(
        new DataObjectPreviewer($generator)
    )
);

License

SilverStripe DataObject Preview is licensed under an MIT license, (*10)

The Versions

03/05 2018

dev-master

9999999-dev

Allows preview of dataobjects in GridField

  Sources   Download

MIT

The Requires

 

03/05 2018

dev-dev

dev-dev

Allows preview of dataobjects in GridField

  Sources   Download

MIT

The Requires

 

12/11 2015

1.0.5

1.0.5.0

Allows preview of dataobjects in GridField

  Sources   Download

MIT

The Requires

 

31/07 2015

1.0.4

1.0.4.0

Allows preview of dataobjects in GridField

  Sources   Download

MIT

The Requires

 

16/07 2015

1.0.3

1.0.3.0

Allows preview of dataobjects in GridField

  Sources   Download

MIT

The Requires

 

04/06 2014

1.0.2

1.0.2.0

Allows preview of dataobjects in GridField

  Sources   Download

MIT

The Requires

 

24/07 2013

1.0.1

1.0.1.0

Allows preview of dataobjects in GridField

  Sources   Download

MIT

The Requires

 

17/07 2013

1.0.0

1.0.0.0

Allows preview of dataobjects in GridField

  Sources   Download

MIT

The Requires