Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / plugin / views / style-preprocess.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/plugin/views/style-preprocess.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/plugin/views/style-preprocess.twig
new file mode 100644 (file)
index 0000000..6578191
--- /dev/null
@@ -0,0 +1,14 @@
+/**
+ * Prepares variables for views-style-{{ plugin_id|u2h }}.html.twig template.
+ */
+function template_preprocess_views_style_{{ plugin_id }}(&$variables) {
+  $handler = $variables['view']->style_plugin;
+
+  // Fetch wrapper classes from handler options.
+  if ($handler->options['wrapper_class']) {
+    $wrapper_class = explode(' ', $handler->options['wrapper_class']);
+    $variables['attributes']['class'] = array_map('\Drupal\Component\Utility\Html::cleanCssIdentifier', $wrapper_class);
+  }
+
+  template_preprocess_views_view_unformatted($variables);
+}