Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SlideImage - implement ImageUploadField #87

Merged
merged 1 commit into from
Mar 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions code/SlideImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ class SlideImage extends DataObject implements PermissionProvider
public function getCMSFields()
{
$fields = parent::getCMSFields();
$ImageField = new UploadField('Image', 'Image');
$ImageField->getValidator()->allowedExtensions = array('jpg', 'jpeg', 'gif', 'png');
$ImageField->setFolderName('Uploads/SlideImages');
$ImageField->setConfig('allowedMaxFileNumber', 1);
$ImageField->getValidator()->setAllowedMaxFileSize(self::config()->get('image_size_limit'));

$fields->removeByName(array('ShowSlide'));

Expand All @@ -88,7 +83,8 @@ public function getCMSFields()
TextareaField::create('Description')
->setDescription('optional, used in template'),
TreeDropdownField::create('PageLinkID', 'Choose a page to link to:', 'SiteTree'),
$ImageField,
ImageUploadField::create('Image')
->setFolderName('Uploads/SlideImages'),
CheckboxField::create('ShowSlide')->setTitle('Show Slide')
->setDescription('Include this slide in the slider. Uncheck to hide'),
));
Expand All @@ -97,8 +93,6 @@ public function getCMSFields()
'PageID',
));

$this->extend('updateCMSFields', $fields);

return $fields;
}

Expand Down
2 changes: 2 additions & 0 deletions docs/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Page::add_extension('FlexSlider');

After attaching the DataExtension to your page type or DataObject run a `dev/build` then `?flush=all`.

This module uses [ImageUploadField](https://github.com/dynamic/silverstripe-imageuploadfield/) for the slide image field. See the [docs](https://github.com/dynamic/silverstripe-imageuploadfield/blob/master/docs/en/index.md) for configuration options such as changing the max upload limit.

### User Guide

You should now see a "Slides" tab on the page type or DataObject to which you applied the DataExtension. Simply create Slides to be included in the slide show that link to other pages on your website.
Expand Down