You are here

class SliderProManager in Slider Pro 8

Class SliderProManager @package Drupal\slider_pro\Manager

Hierarchy

Expanded class hierarchy of SliderProManager

2 files declare their use of SliderProManager
SliderPro.php in src/Plugin/views/style/SliderPro.php
SliderProFormatter.php in src/Plugin/Field/FieldFormatter/SliderProFormatter.php
1 string reference to 'SliderProManager'
slider_pro.services.yml in ./slider_pro.services.yml
slider_pro.services.yml
1 service uses SliderProManager
slider_pro.manager in ./slider_pro.services.yml
Drupal\slider_pro\Manager\SliderProManager

File

src/Manager/SliderProManager.php, line 11

Namespace

Drupal\slider_pro\Manager
View source
class SliderProManager {

  /**
   * returns array of option sets suitable for using as select list options.
   * @return array
   */
  public function getOptionList() {
    $optionsets = SliderPro::loadMultiple();
    $options = [];
    foreach ($optionsets as $name => $optionset) {

      /** @var \Drupal\slider_pro\Entity\SliderProInterface $optionset */
      $options[$name] = $optionset
        ->label();
    }
    if (empty($options)) {
      $options[''] = t('No defined option sets');
    }
    return $options;
  }

  /**
   * Flatten array and preserve keys.
   * @param array $array
   * @return array
   */
  public static function flattenArray(array $array) {
    $flattened_array = array();
    array_walk_recursive($array, function ($a, $key) use (&$flattened_array) {
      $flattened_array[$key] = $a;
    });
    return $flattened_array;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SliderProManager::flattenArray public static function Flatten array and preserve keys.
SliderProManager::getOptionList public function returns array of option sets suitable for using as select list options.