mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 09:05:46 +00:00
FIX: Slider size on missing owner element
This commit is contained in:
parent
38f2098255
commit
142fc48b00
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
namespace A2nt\CMSNiceties\Extensions;
|
namespace A2nt\CMSNiceties\Extensions;
|
||||||
|
|
||||||
|
use A2nt\ElementalBasics\Elements\SliderElement;
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\DatetimeField;
|
use SilverStripe\Forms\DatetimeField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
@ -37,12 +38,20 @@ class SlideImageExtension extends DataExtension
|
|||||||
public function getSlideWidth()
|
public function getSlideWidth()
|
||||||
{
|
{
|
||||||
$element = $this->getElement();
|
$element = $this->getElement();
|
||||||
|
if(!$element->ID) {
|
||||||
|
return SliderElement::config()->get('slide_width');
|
||||||
|
}
|
||||||
|
|
||||||
return $element->getSlideWidth();
|
return $element->getSlideWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSlideHeight()
|
public function getSlideHeight()
|
||||||
{
|
{
|
||||||
$element = $this->getElement();
|
$element = $this->getElement();
|
||||||
|
if(!$element->ID) {
|
||||||
|
return SliderElement::config()->get('slide_height');
|
||||||
|
}
|
||||||
|
|
||||||
return $element->getSlideHeight();
|
return $element->getSlideHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user