summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobin.ingelbrecht2017-05-27 13:34:37 +0200
committerrobin.ingelbrecht2017-05-27 13:34:37 +0200
commit24671eba7c135d80332f9e639e526e42142fe4a8 (patch)
treeb2e9d9a67ddca3f7eed6210a77c808a23bdf2274
parentc9fe5b25138a0b5154b3a4b62abf3d2e490d0954 (diff)
Added extra thumb options and fixed warning if there were no layers configured8.x-1.0-beta2
-rw-r--r--src/Plugin/views/style/SliderPro.php63
-rw-r--r--src/SliderProOptionset.php7
2 files changed, 69 insertions, 1 deletions
diff --git a/src/Plugin/views/style/SliderPro.php b/src/Plugin/views/style/SliderPro.php
index db49fce..55aeafa 100644
--- a/src/Plugin/views/style/SliderPro.php
+++ b/src/Plugin/views/style/SliderPro.php
@@ -81,6 +81,9 @@ class SliderPro extends StylePluginBase {
'fields' => array_keys($this->getAvailableFields()),
'width' => '100',
'height' => '80',
+ 'thumbnail_pointer' => 0,
+ 'thumbnail_arrows' => 0,
+ 'fade_thumbnail_arrows' => 1,
];
$layer_options = isset($this->options['layers_wrapper']) ? $this->options['layers_wrapper'] : [
'wait_for_layers' => 0,
@@ -266,6 +269,62 @@ class SliderPro extends StylePluginBase {
],
];
+ $form['thumbnails']['thumbnail_pointer'] = [
+ '#type' => 'select',
+ '#title' => $this->t('Pointer'),
+ '#options' => [
+ 0 => $this->t('No'),
+ 1 => $this->t('Yes'),
+ ],
+ '#default_value' => $thumb_options['thumbnail_pointer'],
+ '#required' => TRUE,
+ '#description' => $this->t('Indicates if a pointer will be displayed for the selected thumbnail.'),
+ '#states' => [
+ 'invisible' => [
+ 'select[name="style_options[thumbnails][position]"]' => ['value' => '0'],
+ ],
+ ],
+ ];
+
+ $form['thumbnails']['thumbnail_arrows'] = [
+ '#type' => 'select',
+ '#title' => $this->t('Arrows'),
+ '#options' => [
+ 0 => $this->t('No'),
+ 1 => $this->t('Yes'),
+ ],
+ '#default_value' => $thumb_options['thumbnail_arrows'],
+ '#required' => TRUE,
+ '#description' => $this->t('Indicates whether the thumbnail arrows will be enabled.'),
+ '#states' => [
+ 'invisible' => [
+ 'select[name="style_options[thumbnails][position]"]' => ['value' => '0'],
+ ],
+ ],
+ ];
+
+ $form['thumbnails']['fade_thumbnail_arrows'] = [
+ '#type' => 'select',
+ '#title' => $this->t('Fade arrows'),
+ '#options' => [
+ 0 => $this->t('No'),
+ 1 => $this->t('Yes'),
+ ],
+ '#default_value' => $thumb_options['fade_thumbnail_arrows'],
+ '#required' => TRUE,
+ '#description' => $this->t('Indicates whether the thumbnail arrows will be faded.'),
+ '#states' => [
+ 'invisible' => [
+ [
+ 'select[name="style_options[thumbnails][position]"]' => ['value' => '0'],
+ ],
+ [
+ 'select[name="style_options[thumbnails][thumbnail_arrows]"]' => ['value' => '0'],
+ ],
+ ],
+ ],
+ ];
+
$form['layers_wrapper'] = [
'#type' => 'details',
'#title' => $this->t('Layer settings'),
@@ -704,6 +763,10 @@ class SliderPro extends StylePluginBase {
$rows[$i]['thumb'][$fields[$j]] = $rendered_field;
}
+ if (!$layer_options['layers']) {
+ // Make sure layers is an array.
+ $layer_options['layers'] = [];
+ }
$layers = array_slice($layer_options['layers'], 0, $layer_options['number_of_layers']);
foreach ($layers as $key => $layer) {
if (!isset($rows[$i]['layers'][$key])) {
diff --git a/src/SliderProOptionset.php b/src/SliderProOptionset.php
index 7f2788c..1eb7aab 100644
--- a/src/SliderProOptionset.php
+++ b/src/SliderProOptionset.php
@@ -67,11 +67,16 @@ class SliderProOptionset {
if ($this->allowFullScreen) {
$optionset['fadeFullScreen'] = ($this->options['advanced']['fade_full_screen']) ? TRUE : FALSE;
}
-
+
if ($this->useThumbs) {
$optionset['thumbnailWidth'] = (int) $this->options['thumbnails']['width'];
$optionset['thumbnailHeight'] = (int) $this->options['thumbnails']['height'];
$optionset['thumbnailsPosition'] = $this->options['thumbnails']['position'];
+ $optionset['thumbnailPointer'] = ($this->options['thumbnails']['thumbnail_pointer']) ? TRUE : FALSE;
+ $optionset['thumbnailArrows'] = ($this->options['thumbnails']['thumbnail_arrows']) ? TRUE : FALSE;
+ if ($optionset['thumbnailArrows']) {
+ $optionset['fadeThumbnailArrows'] = ($this->options['thumbnails']['fade_thumbnail_arrows']) ? TRUE : FALSE;
+ }
}
if ($this->hasLayers) {