You are here

private function SlickSettingsForm::withInitializer in Slick Carousel 8.2

Provides sample with default Slick markups.

1 call to SlickSettingsForm::withInitializer()
SlickSettingsForm::buildForm in slick_ui/src/Form/SlickSettingsForm.php
Implements \Drupal\Core\Form\FormInterface::buildForm().

File

slick_ui/src/Form/SlickSettingsForm.php, line 132

Class

SlickSettingsForm
Defines the Slick admin settings form.

Namespace

Drupal\slick_ui\Form

Code

private function withInitializer() {
  $items = [];
  foreach ([
    'One',
    'Two',
    'Three',
  ] as $key) {
    $img = '<img src="https://drupal.org/files/' . $key . '.gif" />';
    $items[] = [
      'slide' => [
        '#markup' => $img,
      ],
      'caption' => [
        'title' => $key,
      ],
    ];
  }
  $build = [
    'items' => $items,
    'settings' => [
      'skin' => 'classic',
      'layout' => 'bottom',
    ],
    'options' => [
      'arrows' => TRUE,
      'dots' => TRUE,
    ],
  ];
  $content = \slick()
    ->build($build);
  return $this
    ->preview($content);
}