derralf/silverstripe-minigallery

add a mini gallery to any page type

Installs: 20

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

Type:silverstripe-vendormodule

dev-master / 1.x-dev 2020-02-12 17:44 UTC

This package is auto-updated.

Last update: 2020-03-12 17:52:10 UTC


README

Simple experimental Module to add a small Gallery to any paty type

Private project, no help/support provided

Requirements

  • SilverStripe ^4.1
  • silverstripe/vendor-plugin
  • symbiote/silverstripe-gridfieldextensions
  • derralf/silverstripe-gridfieldtogglevisibility
  • jonom/focuspoint ^3.0

Installation

  • Install the module via Composer
    composer require derralf/silverstripe-minigallery
    

Templates

<% include Derralf\\Minigallery\\Minigallery %>

Configuration

In your config.yml:

Config example 1 (extend single Page Types)

SilverStripe\Blog\Model\BlogPost:
  extensions:
    - Derralf\Minigallery\MiniGalleryPageExtension

Config example 2 (define include list)

Page:
  extensions:
    - Derralf\Minigallery\MiniGalleryPageExtension

Derralf\Minigallery\MiniGalleryPageExtension:
  allowed_pagetypes:
    - SilverStripe\Blog\Model\BlogPost
    - My\Namespace\SomePageType
    - Other\Namespace\OtherPageType
  

Config example 3 (define exclude list)

Page:
  extensions:
    - Derralf\Minigallery\MiniGalleryPageExtension

Derralf\Minigallery\MiniGalleryPageExtension:
  disallowed_pagetypes:
    - My\NameSpace\HomePage
    - My\Other\Excluded\PageType
  

Don't mix allowed_pagetypes and disallowed_pagetypes

Set image upload folder name

  1. custom function on your page type
## e.g.
public function getCustomMiniGalleryUploadFolderName() {
    return 'minigallery-partner-' . $this->URLSegment;
}


if(method_exists($this->owner, 'getCustomMiniGalleryUploadFolderName')) {
            return $this->owner->getCustomMiniGalleryUploadFolderName();
        }
        if($this->owner->config()->get('minigallery_upload_foldername')) {
            return $this->owner->config()->get('minigallery_upload_foldername');
        }
        return $this->config()->get('image_upload_foldername');

or 2. per page type config

Page:
  minigallery_upload_foldername: 'minigallery-page'

HomePage:
  minigallery_upload_foldername: 'minigallery-homepage'

or 3. with extension config (defaults to 'minigallery')

Derralf\Minigallery\MiniGalleryPageExtension:
  image_upload_foldername: 'minigallery'