Same name in other branches
  1. 5.0.x src/Plugin/views/style/Slideshow.php \Drupal\views_slideshow\Plugin\views\style\Slideshow::defineOptions()
  2. 8.x-3.x src/Plugin/views/style/Slideshow.php \Drupal\views_slideshow\Plugin\views\style\Slideshow::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;
}