annotate vendor/chi-teck/drupal-code-generator/templates/d8/plugin/views/style-plugin.twig @ 5:12f9dff5fda9
tip
Update to Drupal core 8.7.1
author |
Chris Cannam |
date |
Thu, 09 May 2019 15:34:47 +0100 |
parents |
c75dbcec494b |
children |
|
rev |
line source |
Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\{{ machine_name }}\Plugin\views\style;
|
Chris@0
|
4
|
Chris@5
|
5 {% if configurable %}
|
Chris@0
|
6 use Drupal\Core\Form\FormStateInterface;
|
Chris@5
|
7 {% endif %}
|
Chris@0
|
8 use Drupal\views\Plugin\views\style\StylePluginBase;
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * {{ plugin_label }} style plugin.
|
Chris@0
|
12 *
|
Chris@0
|
13 * @ViewsStyle(
|
Chris@0
|
14 * id = "{{ plugin_id }}",
|
Chris@0
|
15 * title = @Translation("{{ plugin_label }}"),
|
Chris@0
|
16 * help = @Translation("Foo style plugin help."),
|
Chris@0
|
17 * theme = "views_style_{{ plugin_id }}",
|
Chris@0
|
18 * display_types = {"normal"}
|
Chris@0
|
19 * )
|
Chris@0
|
20 */
|
Chris@0
|
21 class {{ class }} extends StylePluginBase {
|
Chris@0
|
22
|
Chris@0
|
23 /**
|
Chris@0
|
24 * {@inheritdoc}
|
Chris@0
|
25 */
|
Chris@0
|
26 protected $usesRowPlugin = TRUE;
|
Chris@0
|
27
|
Chris@0
|
28 /**
|
Chris@0
|
29 * {@inheritdoc}
|
Chris@0
|
30 */
|
Chris@0
|
31 protected $usesRowClass = TRUE;
|
Chris@0
|
32
|
Chris@5
|
33 {% if configurable %}
|
Chris@0
|
34 /**
|
Chris@0
|
35 * {@inheritdoc}
|
Chris@0
|
36 */
|
Chris@0
|
37 protected function defineOptions() {
|
Chris@0
|
38 $options = parent::defineOptions();
|
Chris@0
|
39 $options['wrapper_class'] = ['default' => 'item-list'];
|
Chris@0
|
40 return $options;
|
Chris@0
|
41 }
|
Chris@0
|
42
|
Chris@0
|
43 /**
|
Chris@0
|
44 * {@inheritdoc}
|
Chris@0
|
45 */
|
Chris@0
|
46 public function buildOptionsForm(&$form, FormStateInterface $form_state) {
|
Chris@0
|
47 parent::buildOptionsForm($form, $form_state);
|
Chris@0
|
48 $form['wrapper_class'] = [
|
Chris@0
|
49 '#title' => $this->t('Wrapper class'),
|
Chris@0
|
50 '#description' => $this->t('The class to provide on the wrapper, outside rows.'),
|
Chris@0
|
51 '#type' => 'textfield',
|
Chris@0
|
52 '#default_value' => $this->options['wrapper_class'],
|
Chris@0
|
53 ];
|
Chris@0
|
54 }
|
Chris@0
|
55
|
Chris@5
|
56 {% endif %}
|
Chris@0
|
57 }
|