You are here

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

Helper function to get the index of the class at options list.

Parameters

string $name: A config style name like background_color.

string $class: The class name.

Return value

int The index.

2 calls to StylePluginBase::getStyleOptionIndexByClass()
Border::buildStyleFormElements in src/Plugin/BootstrapStyles/Style/Border.php
Margin::buildStyleFormElements in src/Plugin/BootstrapStyles/Style/Margin.php

File

src/Style/StylePluginBase.php, line 154

Class

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

Namespace

Drupal\bootstrap_styles\Style

Code

public function getStyleOptionIndexByClass(string $name, string $class) {
  $index = 0;
  $options = $this
    ->getStyleOptions($name);
  $count = 0;
  foreach ($options as $key => $value) {
    if ($key == $class) {
      $index = $count;
      break;
    }
    $count++;
  }
  return $index;
}