diff vendor/chi-teck/drupal-code-generator/templates/d8/plugin/views/style-plugin.twig @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children 12f9dff5fda9
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/chi-teck/drupal-code-generator/templates/d8/plugin/views/style-plugin.twig	Thu Jul 05 14:24:15 2018 +0000
@@ -0,0 +1,53 @@
+<?php
+
+namespace Drupal\{{ machine_name }}\Plugin\views\style;
+
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\views\Plugin\views\style\StylePluginBase;
+
+/**
+ * {{ plugin_label }} style plugin.
+ *
+ * @ViewsStyle(
+ *   id = "{{ plugin_id }}",
+ *   title = @Translation("{{ plugin_label }}"),
+ *   help = @Translation("Foo style plugin help."),
+ *   theme = "views_style_{{ plugin_id }}",
+ *   display_types = {"normal"}
+ * )
+ */
+class {{ class }} extends StylePluginBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected $usesRowPlugin = TRUE;
+
+  /**
+   * {@inheritdoc}
+   */
+  protected $usesRowClass = TRUE;
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function defineOptions() {
+    $options = parent::defineOptions();
+    $options['wrapper_class'] = ['default' => 'item-list'];
+    return $options;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
+    parent::buildOptionsForm($form, $form_state);
+    $form['wrapper_class'] = [
+      '#title' => $this->t('Wrapper class'),
+      '#description' => $this->t('The class to provide on the wrapper, outside rows.'),
+      '#type' => 'textfield',
+      '#default_value' => $this->options['wrapper_class'],
+    ];
+  }
+
+}