Created
August 23, 2017 22:36
-
-
Save unclecheese/2ce2238f7ee7167cd9ed47c294b04e05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const slides = JSON.parse($('body').data('slides')); | |
$('body').vegas({ | |
delay: 3000, | |
timer: false, | |
slides | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class YourPage extends Page | |
{ | |
private static $has_one = [ | |
'Slideshow1' => 'Image', | |
'Slideshow2' => 'Image', | |
// etc.. | |
]; | |
public function getCMSFields() | |
{ | |
//.... | |
} | |
public function getSlideURLs() | |
{ | |
return Convert::array2json(array_map(function($num) { | |
return $this->{'Slideshow'.$num}()->URL; | |
}, range(1, 6))); | |
} | |
} | |
class YourPage_Controller extends Page_Controller | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body data-slides="$SlideURLs"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment