diff --git a/src/Components/SliderComponent.php b/src/Components/SliderComponent.php index 7fd214b..37aa60d 100644 --- a/src/Components/SliderComponent.php +++ b/src/Components/SliderComponent.php @@ -18,6 +18,7 @@ namespace SilverWare\Slider\Components; use SilverStripe\Forms\CheckboxField; +use SilverStripe\Forms\HTMLEditor\HTMLEditorField; use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\NumericField; use SilverStripe\ORM\ArrayList; @@ -119,6 +120,7 @@ class SliderComponent extends BaseComponent * @config */ private static $db = [ + 'IntroContent' => 'HTMLText', 'Mode' => 'Varchar(16)', 'Auto' => 'Boolean', 'Loop' => 'Boolean', @@ -239,6 +241,18 @@ public function getCMSFields() $placeholder = _t(__CLASS__ . '.DROPDOWNDEFAULT', '(default)'); + // Create Main Fields: + + $fields->addFieldsToTab( + 'Root.Main', + [ + HTMLEditorField::create( + 'IntroContent', + $this->fieldLabel('IntroContent') + ) + ] + ); + // Create Style Fields: $fields->addFieldsToTab( @@ -414,6 +428,7 @@ public function fieldLabels($includerelations = true) $labels['ColorControl'] = _t(__CLASS__ . '.CONTROLCOLOR', 'Control color'); $labels['HideCaptionsOnMobile'] = _t(__CLASS__ . '.HIDECAPTIONSONMOBILE', 'Hide captions on mobile'); $labels['ThumbMargin'] = _t(__CLASS__ . '.MARGININPX', 'Margin (in pixels)'); + $labels['IntroContent'] = _t(__CLASS__ . '.INTROCONTENT', 'Intro content'); // Answer Field Labels: diff --git a/templates/SilverWare/Slider/Components/SliderComponent.ss b/templates/SilverWare/Slider/Components/SliderComponent.ss index 44fcd98..9821189 100644 --- a/templates/SilverWare/Slider/Components/SliderComponent.ss +++ b/templates/SilverWare/Slider/Components/SliderComponent.ss @@ -1,3 +1,4 @@ +<% include SilverWare\Slider\Components\SliderComponent\Intro %> diff --git a/templates/SilverWare/Slider/Components/SliderComponent/Includes/Intro.ss b/templates/SilverWare/Slider/Components/SliderComponent/Includes/Intro.ss new file mode 100644 index 0000000..445545b --- /dev/null +++ b/templates/SilverWare/Slider/Components/SliderComponent/Includes/Intro.ss @@ -0,0 +1,5 @@ +<% if $IntroContent %> +
+ $IntroContent +
+<% end_if %>