private function SlickSettingsForm::preview in Slick Carousel 8.2
Provides sample w/o default Slick markups.
2 calls to SlickSettingsForm::preview()
- SlickSettingsForm::withInitializer in slick_ui/
src/ Form/ SlickSettingsForm.php - Provides sample with default Slick markups.
- SlickSettingsForm::withoutInitializer in slick_ui/
src/ Form/ SlickSettingsForm.php - Provides sample without default Slick markups.
File
- slick_ui/
src/ Form/ SlickSettingsForm.php, line 184
Class
- SlickSettingsForm
- Defines the Slick admin settings form.
Namespace
Drupal\slick_ui\FormCode
private function preview($content, $prefix = '', $suffix = '') {
$config = $this
->config('slick.settings');
$unload = $config
->get('sitewide') == 2 || $config
->get('sitewide') == 3;
$attach = \slick()
->attach([
'_unload' => $unload,
'_vanilla' => $config
->get('sitewide') == 2,
]);
if (empty($suffix)) {
$suffix = "<blockquote><pre><div class="slick" data-slick="{'arrows': true, 'dots': true}">\n <div class="slick__slider">\n <div class="slick__slide"><img src="https://drupal.org/files/One.gif" /></div>\n <div class="slick__slide"><img src="https://drupal.org/files/Two.gif" /></div>\n <div class="slick__slide"><img src="https://drupal.org/files/Three.gif" /></div>\n </div>\n <nav class="slick__arrow" > </nav>\n</div></pre></blockquote>";
}
return [
'#type' => 'inline_template',
'#template' => '{{ prefix | raw }}{{ stage }}{{ suffix | raw }}',
'#context' => [
'stage' => $content,
'prefix' => '<div style="background: rgb(52, 152, 219);"><div style="margin: 30px auto; max-width: 350px; min-height: 240px; text-align: center;" ' . $prefix . '>',
'suffix' => '</div></div>' . $suffix,
],
'#attached' => $attach,
];
}