summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorenttorregrosa2017-05-17 15:46:04 -0500
committerMark Carver2017-05-17 15:46:04 -0500
commit3591759e2fb6f3f63e860fe83990e2330448f8f0 (patch)
tree35170a59eae440a9336f6b5ea9fa8ba814009ec4
parent7bdda61858f38a9441484fc892f68d74fc9fd18f (diff)
Issue #2878764 by Grimreaper, markcarver: Data target not set for Bootstrap carousel
-rw-r--r--src/Plugin/Preprocess/BootstrapCarousel.php4
-rw-r--r--src/Plugin/Preprocess/ItemListBootstrapCarouselIndicators.php25
2 files changed, 28 insertions, 1 deletions
diff --git a/src/Plugin/Preprocess/BootstrapCarousel.php b/src/Plugin/Preprocess/BootstrapCarousel.php
index 4945971..cb148ac 100644
--- a/src/Plugin/Preprocess/BootstrapCarousel.php
+++ b/src/Plugin/Preprocess/BootstrapCarousel.php
@@ -75,7 +75,9 @@ class BootstrapCarousel extends PreprocessBase implements PreprocessInterface {
'#theme' => 'item_list__bootstrap_carousel_indicators',
'#list_type' => 'ol',
'#items' => array_keys($variables->slides),
- '#target' => "#$id",
+ '#context' => [
+ 'target' => "#$id",
+ ],
'#start_index' => $variables->start_index,
];
}
diff --git a/src/Plugin/Preprocess/ItemListBootstrapCarouselIndicators.php b/src/Plugin/Preprocess/ItemListBootstrapCarouselIndicators.php
new file mode 100644
index 0000000..4bc113c
--- /dev/null
+++ b/src/Plugin/Preprocess/ItemListBootstrapCarouselIndicators.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Drupal\bootstrap\Plugin\Preprocess;
+
+use Drupal\bootstrap\Utility\Variables;
+
+/**
+ * Pre-processes for the "item_list__bootstrap_carousel_indicators" theme hook.
+ *
+ * @ingroup plugins_preprocess
+ *
+ * @BootstrapPreprocess("item_list__bootstrap_carousel_indicators")
+ */
+class ItemListBootstrapCarouselIndicators extends PreprocessBase implements PreprocessInterface {
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function preprocessVariables(Variables $variables) {
+ parent::preprocessVariables($variables);
+
+ $variables->target = $variables->getContext('target');
+ }
+
+}