Inline/tiled images in a SilverStripe GridField table
PHP CSS
Latest commit f58637b Feb 7, 2017 @axllent committed on GitHub Merge pull request #2 from helpfulrobot/add-standard-scrutinizer-config
Added standard Scrutinizer config
Permalink
Failed to load latest commit information.
code Converted to PSR-2 Dec 20, 2015
css Fix Firefox css Sep 2, 2014
screenshots
.editorconfig
.scrutinizer.yml
LICENSE
README.md
_config.php
composer.json

README.md

Tiled GridField for SilverStripe

Inline/tiled images in a standard SilverStripe GridField table.

I created it to give me a better overview of thumbnails returned in a GridField listing (think of a photo gallery). This hack simply applies a CSS class to the GridField fieldset to provide a tiled layout.

Screenshot

Requirements

The only requirement is that the $summary_fields of the DataObject should return just one field, and it should be an image (thumbnail). The images should at least all be the same height, preferably cropped.

Please note that if more than one $summary_fields is used then the layout will break.

Installation

composer require axllent/silverstripe-tiled-gridfield

Example

$gridFieldConfig = GridFieldConfig_RecordEditor::create(200);
$gridField = new TiledGridField('AlbumImages', 'Album Images', $this->Photos(), $gridFieldConfig);
$fields->addFieldToTab('Root.Main', $gridField);

Photo management tools

The module is complatible with GridFieldBulkEditingTools (GridFieldBulkUpload) as well as SortableGridField.

$gridFieldConfig = GridFieldConfig_RecordEditor::create(200);
$gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
$gridFieldConfig->addComponent(new GridFieldBulkUpload());
$gridFieldConfig->getComponentByType('GridFieldBulkUpload')->setConfig('folderName', 'Photos');
$gridField = new TiledGridField('AlbumImages', 'Album Images', $this->Photos(), $gridFieldConfig);
$fields->addFieldToTab('Root.Main', $gridField);