Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / plugin / views / style-plugin.twig
1 <?php
2
3 namespace Drupal\{{ machine_name }}\Plugin\views\style;
4
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\views\Plugin\views\style\StylePluginBase;
7
8 /**
9  * {{ plugin_label }} style plugin.
10  *
11  * @ViewsStyle(
12  *   id = "{{ plugin_id }}",
13  *   title = @Translation("{{ plugin_label }}"),
14  *   help = @Translation("Foo style plugin help."),
15  *   theme = "views_style_{{ plugin_id }}",
16  *   display_types = {"normal"}
17  * )
18  */
19 class {{ class }} extends StylePluginBase {
20
21   /**
22    * {@inheritdoc}
23    */
24   protected $usesRowPlugin = TRUE;
25
26   /**
27    * {@inheritdoc}
28    */
29   protected $usesRowClass = TRUE;
30
31   /**
32    * {@inheritdoc}
33    */
34   protected function defineOptions() {
35     $options = parent::defineOptions();
36     $options['wrapper_class'] = ['default' => 'item-list'];
37     return $options;
38   }
39
40   /**
41    * {@inheritdoc}
42    */
43   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
44     parent::buildOptionsForm($form, $form_state);
45     $form['wrapper_class'] = [
46       '#title' => $this->t('Wrapper class'),
47       '#description' => $this->t('The class to provide on the wrapper, outside rows.'),
48       '#type' => 'textfield',
49       '#default_value' => $this->options['wrapper_class'],
50     ];
51   }
52
53 }