You are here

public function StylePluginBase::getStyleOptions in Bootstrap Styles 1.0.x

Helper function to get the options of given style name.

Parameters

string $name: A config style name like background_color.

Return value

array Array of key => value of style name options.

10 calls to StylePluginBase::getStyleOptions()
BackgroundColor::buildStyleFormElements in src/Plugin/BootstrapStyles/Style/BackgroundColor.php
Border::buildStyleFormElements in src/Plugin/BootstrapStyles/Style/Border.php
BoxShadow::buildStyleFormElements in src/Plugin/BootstrapStyles/Style/BoxShadow.php
Margin::buildStyleFormElements in src/Plugin/BootstrapStyles/Style/Margin.php
ScrollEffects::buildStyleFormElements in src/Plugin/BootstrapStyles/Style/ScrollEffects.php

... See full list

File

src/Style/StylePluginBase.php, line 84

Class

StylePluginBase
A base class to help developers implement their own Styles Group plugins.

Namespace

Drupal\bootstrap_styles\Style

Code

public function getStyleOptions(string $name) {
  $config = $this
    ->config();
  $options = [];
  $config_options = $config
    ->get($name);
  $options = [
    '_none' => $this
      ->t('N/A'),
  ];
  $lines = explode(PHP_EOL, $config_options);
  foreach ($lines as $line) {
    $line = explode('|', $line);
    if ($line && isset($line[0]) && isset($line[1])) {
      $options[$line[0]] = $line[1] . '<div class="bs_tooltip" data-placement="top" role="tooltip">' . $line[1] . '</div>';
    }
  }
  return $options;
}