You are here

public function ScrollEffects::buildStyleFormElements in Bootstrap Styles 1.0.x

Overrides StylePluginBase::buildStyleFormElements

File

src/Plugin/BootstrapStyles/Style/ScrollEffects.php, line 88

Class

ScrollEffects
Class Effect.

Namespace

Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style

Code

public function buildStyleFormElements(array &$form, FormStateInterface $form_state, $storage) {
  $form['scroll_effects'] = [
    '#type' => 'radios',
    '#options' => $this
      ->getStyleOptions('scroll_effects'),
    '#title' => $this
      ->t('Scroll Effects'),
    '#default_value' => $storage['scroll_effects']['class'] ?? NULL,
    '#validated' => TRUE,
    '#attributes' => [
      'class' => [
        'field-scroll-effects',
      ],
    ],
    '#prefix' => '<span class="input-icon"></span>',
  ];

  // Add icons to the effets.
  foreach ($form['scroll_effects']['#options'] as $key => $value) {
    $form['scroll_effects']['#options'][$key] = '<span class="input-icon ' . $key . '"></span>' . $value;
  }
  return $form;
}