Skip to content

Commit

Permalink
added default profile to fix error when none is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Makreig committed Jul 9, 2019
1 parent a7b2972 commit 9d95061
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/model/CarouselSlide.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ class CarouselSlide extends DataObject
* @config
*/
private static $default_sort = "Sort ASC";

/**
* Default image profile to use
*
* @var string
* @config
*/
private static $default_proile = 'ShortCarousel';

/**
* Get fully rendered image for template
Expand All @@ -98,6 +106,11 @@ public function getRenderedImage()
{
$parent = $this->Parent();
$profile = $parent->CarouselProfile;
if ($profile) {
return $this->Image->{$profile}();
} else {
$profile = $this->config()->default_proile;
}

return $this->Image->{$profile}();
}
Expand Down

0 comments on commit 9d95061

Please sign in to comment.