From 6cbf5ea6622bd7d88ceb921a4104650c14d7ada4 Mon Sep 17 00:00:00 2001 From: Tony Air Date: Tue, 19 Apr 2022 15:19:49 +0200 Subject: [PATCH] IMPR: Bulk slider uploader --- src/Elements/SliderElement.php | 7 ++++--- src/Extensions/SlideImageEx.php | 7 +------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Elements/SliderElement.php b/src/Elements/SliderElement.php index 58ee7e1..b3fca98 100755 --- a/src/Elements/SliderElement.php +++ b/src/Elements/SliderElement.php @@ -90,10 +90,11 @@ class SliderElement extends ElementSlideshow if ($grid) { $config = $grid->getConfig(); - /*$bulk = new BulkUploader('Image', Image::class, true); + $bulk = new BulkUploader('Image', SlideImage::class, false); $bulk - ->setUfSetup('setFolderName', 'Uploads/SlideImages'); - $config->addComponent($bulk);*/ + ->setUfSetup('setFolderName', 'Uploads/SlideImages') + ->setUfSetup('getValidator.setAllowedExtensions', ['jpg', 'jpeg', 'png', 'gif']); + $config->addComponent($bulk); $columns = new GridFieldEditableColumns(); diff --git a/src/Extensions/SlideImageEx.php b/src/Extensions/SlideImageEx.php index f429691..c044efe 100755 --- a/src/Extensions/SlideImageEx.php +++ b/src/Extensions/SlideImageEx.php @@ -18,15 +18,10 @@ use SilverStripe\ORM\ValidationResult; class SlideImageEx extends DataExtension { - /*public function onBulkUpload() - { - die('saadsadssdsda2222'); - } - public function validate(ValidationResult $validationResult) { if (!$this->owner->Name) { $this->owner->Name = rand(); } - }*/ + } }