jssor_views_plugins_style.inc in Jssor Slider 7
File
jssor_views_plugins_style.inc
View source
<?php
class jssor_views_plugins_style extends views_plugin_style {
function options(&$options) {
self::bootstrapClasses();
$jssor = new JssorViewsStylePlugin();
$options = array_merge($options, self::option_definition(), $jssor
->defaultOptions());
if (count($options['grouping']) == 1 && isset($options['grouping']['default'])) {
$options['grouping'] = array();
}
return $options;
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
self::bootstrapClasses();
$jssor = new \Drupal\jssor\Plugin\views\style\Jssor($this);
$form_state_holder = new \Drupal\Core\Form\FormStateInterface($form_state);
$jssor
->buildOptionsForm($form, $form_state_holder);
$form['global'] = $this::fixD8FormTypes($form['global']);
$form['bulletnavigator'] = $this::fixD8FormTypes($form['bulletnavigator']);
}
private static function fixD8FormTypes($form) {
foreach ($form as $key => $element) {
if (stripos($key, "#") === false) {
if ($form[$key]['#type'] == 'number') {
$form[$key]['#type'] = 'textfield';
}
}
}
return $form;
}
private static function bootstrapClasses() {
$module = 'jssor';
module_load_include('inc', $module, 'src/shims/Attribute');
module_load_include('inc', $module, 'src/shims/FormStateInterface');
module_load_include('inc', $module, 'plugins/views_plugin_style_default');
module_load_include('inc', $module, 'src/shims/ViewsStylePluginBase');
module_load_include('php', $module, 'src/Plugin/views/style/Jssor');
module_load_include('inc', $module, 'src/JssorViewsStylePlugin');
}
public function getRowClass($id) {
return 'row-' . $id;
}
}