2017 © Pedro PelĂĄez
 

silverstripe-vendormodule folderperpage

An extension for automatically creating a folder per page

image

wernerkrauss/folderperpage

An extension for automatically creating a folder per page

  • Wednesday, February 28, 2018
  • by wernerkrauss
  • Repository
  • 1 Watchers
  • 1 Stars
  • 361 Installations
  • PHP
  • 0 Dependents
  • 2 Suggesters
  • 2 Forks
  • 6 Open issues
  • 7 Versions
  • 9 % Grown

The README.md

silverstripe-folderperpage

Build Status Scrutinizer Code Quality codecov.io helpfulrobot, (*1)

Extension that creates a folder per page or dataobject, (*2)

Requirements

for SS3 compatible versions see SS3 branch, (*3)

Installation

Download and install manually or use composer., (*4)

Make sure you add the extension to the classes you want to decorate. Add this to your config.yml to add it to all Pages:, (*5)

Page:
  extensions:
    - NetWerkstatt\FolderPerPage\Extensions\RootFolder

Configuration

You can exclude several page types. Just use the RootFolder.ignored_classes config value. The module's config.yml has some default values to get you started:, (*6)

NetWerkstatt\FolderPerPage\Extensions\RootFolder:
  ignored_classes:
    - SilverStripe\CMS\Model\VirtualPage
    - SilverStripe\ErrorPage\ErrorPage
  create_folder_for_translations: false
  folder_root: 'Articles'

Of course every decorated class can have a seperate folder root, e.g. "Articles" for all pages and "News" for a news data object. Just add the folder_root config to your object., (*7)

Update your forms

You can use $this->getRootFoldername() to set the upload folder., (*8)

Given you have a has_one relation "Avatar" => "Image" you can add the folder to the UploadField:, (*9)

function getCMSFields() {
    /*...*/
    $pic = UploadField::create('Avatar', 'Your Avatar');
    $fields->addFieldToTab('Root.Main', $pic);

    $pic->setFolderName($this->getRootFolderName());
    /*...*/
}

TODO

  • ~~make it work for other dataobjects~~
  • ~~unit tests~~
  • add function that automatically updates all UploadFields and BulkUploads to use this folder in a form
  • add support for subsites module, e.g. a master root per subsite
  • task for updating / checking all existing pages
  • ~~check if page is moved~~
    • should it move the rootfolder automatically or by switch? May be a timeout problem with very large trees

The Versions

28/02 2018

dev-master

9999999-dev

An extension for automatically creating a folder per page

  Sources   Download

MIT

The Requires

 

The Development Requires

extension silverstripe

28/02 2018

dev-update-to-ss4

dev-update-to-ss4

An extension for automatically creating a folder per page

  Sources   Download

MIT

The Requires

 

The Development Requires

extension silverstripe

03/11 2017

dev-ss3

dev-ss3

An extension for automatically creating a folder per page

  Sources   Download

MIT

The Requires

 

extension silverstripe

09/03 2016

0.2.2

0.2.2.0

An extension for automatically creating a folder per page

  Sources   Download

MIT

The Requires

 

extension silverstripe

31/12 2015

0.2.1

0.2.1.0

An extension for automatically creating a folder per page

  Sources   Download

MIT

The Requires

 

extension silverstripe

31/12 2015

0.2.0

0.2.0.0

An extension for automatically creating a folder per page

  Sources   Download

MIT

The Requires

 

extension silverstripe

20/05 2014

0.1.0

0.1.0.0

An extension for automatically creating a folder per page

  Sources   Download

MIT

The Requires

 

extension silverstripe