You are here

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\Form

Code

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>&lt;div class=&quot;slick&quot; data-slick=&quot;{'arrows': true, 'dots': true}&quot;&gt;\n  &lt;div class=&quot;slick__slider&quot;&gt;\n    &lt;div class=&quot;slick__slide&quot;&gt;&lt;img src=&quot;https://drupal.org/files/One.gif&quot; /&gt;&lt;/div&gt;\n    &lt;div class=&quot;slick__slide&quot;&gt;&lt;img src=&quot;https://drupal.org/files/Two.gif&quot; /&gt;&lt;/div&gt;\n    &lt;div class=&quot;slick__slide&quot;&gt;&lt;img src=&quot;https://drupal.org/files/Three.gif&quot; /&gt;&lt;/div&gt;\n  &lt;/div&gt;\n  &lt;nav class=&quot;slick__arrow&quot; &gt; &lt;/nav&gt;\n&lt;/div&gt;</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,
  ];
}