From 0fb234288783dde98cde0a83eb9e20cb30da68b9 Mon Sep 17 00:00:00 2001 From: Tony Air Date: Tue, 19 Apr 2022 13:50:36 +0200 Subject: [PATCH] IMPR: Multi-slider --- _config/config.yml | 4 +++ src/Elements/SliderElement.php | 12 ++++++- src/Extensions/SlideImageEx.php | 32 +++++++++++++++++++ .../ElementalBasics/Elements/SliderElement.ss | 15 ++++++++- 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100755 src/Extensions/SlideImageEx.php diff --git a/_config/config.yml b/_config/config.yml index a810215..c405b3f 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -62,3 +62,7 @@ Dynamic\Elements\Image\Elements\ElementImage: DNADesign\ElementalVirtual\Model\ElementVirtual: controller_template: VirtualElementHolder + +Dynamic\FlexSlider\Model\SlideImage: + extensions: + - A2nt\ElementalBasics\Extensions\SlideImageEx \ No newline at end of file diff --git a/src/Elements/SliderElement.php b/src/Elements/SliderElement.php index 0e7302d..58ee7e1 100755 --- a/src/Elements/SliderElement.php +++ b/src/Elements/SliderElement.php @@ -8,9 +8,11 @@ namespace A2nt\ElementalBasics\Elements; +use Colymba\BulkUpload\BulkUploader; use Dynamic\Elements\Flexslider\Elements\ElementSlideshow; use Dynamic\FlexSlider\Model\SlideImage; use Dynamic\FlexSlider\ORM\FlexSlider; +use SilverStripe\Assets\Image; use SilverStripe\Core\Injector\Injector; use SilverStripe\Forms\CheckboxField; use SilverStripe\Forms\LiteralField; @@ -33,6 +35,7 @@ class SliderElement extends ElementSlideshow private static $db = [ 'Interval' => 'Int', + 'SlidesInRow' => 'Int', ]; private static $extensions = [ @@ -79,13 +82,20 @@ class SliderElement extends ElementSlideshow ]); $fields->addFieldsToTab('Root.Settings', [ - NumericField::create('Interval', 'Auto-play Interval'), + NumericField::create('Interval', 'Auto-play Interval (sec)'), + NumericField::create('SlidesInRow'), ]); $grid = $fields->dataFieldByName('Slides'); if ($grid) { $config = $grid->getConfig(); + /*$bulk = new BulkUploader('Image', Image::class, true); + $bulk + ->setUfSetup('setFolderName', 'Uploads/SlideImages'); + $config->addComponent($bulk);*/ + + $columns = new GridFieldEditableColumns(); $columns->setDisplayFields([ 'Hide' => [ diff --git a/src/Extensions/SlideImageEx.php b/src/Extensions/SlideImageEx.php new file mode 100755 index 0000000..f429691 --- /dev/null +++ b/src/Extensions/SlideImageEx.php @@ -0,0 +1,32 @@ +owner->Name) { + $this->owner->Name = rand(); + } + }*/ +} diff --git a/templates/A2nt/ElementalBasics/Elements/SliderElement.ss b/templates/A2nt/ElementalBasics/Elements/SliderElement.ss index 269e60f..ad458b5 100755 --- a/templates/A2nt/ElementalBasics/Elements/SliderElement.ss +++ b/templates/A2nt/ElementalBasics/Elements/SliderElement.ss @@ -9,7 +9,20 @@ <% if $SlideShow %>
-