You are here

protected function Slideshow::defineOptions in Views Slideshow 8.4

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/style/Slideshow.php \Drupal\views_slideshow\Plugin\views\style\Slideshow::defineOptions()

Information about options for all kinds of purposes will be held here.


'option_name' => array(
 - 'default' => default value,
 - 'contains' => (optional) array of items this contains, with its own
     defaults, etc. If contains is set, the default will be ignored and
     assumed to be array().
 ),

Return value

array Returns the options of this handler/plugin.

Overrides StylePluginBase::defineOptions

File

src/Plugin/views/style/Slideshow.php, line 59

Class

Slideshow
Style plugin to render each item in a slideshow.

Namespace

Drupal\views_slideshow\Plugin\views\style

Code

protected function defineOptions() {
  $options = parent::defineOptions();
  $options['row_class_custom'] = [
    'default' => '',
  ];
  $options['row_class_default'] = [
    'default' => TRUE,
  ];
  $options['slideshow_type'] = [
    'default' => 'views_slideshow_cycle',
  ];
  $options['slideshow_skin'] = [
    'default' => 'default',
  ];
  $typeManager = \Drupal::service('plugin.manager.views_slideshow.slideshow_type');
  foreach ($typeManager
    ->getDefinitions() as $id => $definition) {
    $instance = $typeManager
      ->createInstance($id, []);
    $options[$id] = $instance
      ->defaultConfiguration();
  }
  $widgetTypeManager = \Drupal::service('plugin.manager.views_slideshow.widget_type');
  $widgetTypes = $widgetTypeManager
    ->getDefinitions();
  foreach ([
    'top',
    'bottom',
  ] as $location) {
    foreach ($widgetTypes as $widgetTypeId => $widgetTypeDefinition) {
      $options['widgets']['contains'][$location]['contains'][$widgetTypeId]['contains'] = $widgetTypeManager
        ->createInstance($widgetTypeId, [])
        ->defaultConfiguration();
    }
  }
  return $options;
}