You are here

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

Overrides StylePluginBase::buildStyleFormElements

File

src/Plugin/BootstrapStyles/Style/BoxShadow.php, line 52

Class

BoxShadow
Class BoxShadow.

Namespace

Drupal\bootstrap_styles\Plugin\BootstrapStyles\Style

Code

public function buildStyleFormElements(array &$form, FormStateInterface $form_state, $storage) {
  $form['box_shadow'] = [
    '#type' => 'radios',
    '#options' => $this
      ->getStyleOptions('box_shadow'),
    '#title' => $this
      ->t('Box Shadow'),
    '#title_display' => 'invisible',
    '#default_value' => $storage['box_shadow']['class'] ?? NULL,
    '#validated' => TRUE,
    '#attributes' => [
      'class' => [
        'bs-field-box-shadow',
      ],
    ],
  ];

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

  // Attach the Layout Builder form style for this plugin.
  $form['#attached']['library'][] = 'bootstrap_styles/plugin.box_shadow.layout_builder_form';
  return $form;
}