More tidying.
[yaffs-website] / web / modules / contrib / views_bootstrap / src / Plugin / views / style / ViewsBootstrapListGroup.php
1 <?php
2
3 namespace Drupal\views_bootstrap\Plugin\views\style;
4
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\views\Plugin\views\style\StylePluginBase;
7
8 /**
9  * Style plugin to render each item in an ordered or unordered list.
10  *
11  * @ingroup views_style_plugins
12  *
13  * @ViewsStyle(
14  *   id = "views_bootstrap_list_group",
15  *   title = @Translation("Bootstrap List Group"),
16  *   help = @Translation("Displays rows in a Bootstrap List Group."),
17  *   theme = "views_bootstrap_list_group",
18  *   theme_file = "../views_bootstrap.theme.inc",
19  *   display_types = {"normal"}
20  * )
21  */
22 class ViewsBootstrapListGroup extends StylePluginBase {
23
24   /**
25    * Overrides \Drupal\views\Plugin\views\style\StylePluginBase::usesRowPlugin.
26    *
27    * @var bool
28    */
29   protected $usesRowPlugin = TRUE;
30
31   /**
32    * Overrides \Drupal\views\Plugin\views\style\StylePluginBase::usesRowClass.
33    *
34    * @var bool
35    */
36   protected $usesRowClass = TRUE;
37
38   /**
39    * Definition.
40    */
41   protected function defineOptions() {
42     $options = parent::defineOptions();
43     $options['link_field'] = ['default' => []];
44     return $options;
45   }
46
47   /**
48    * {@inheritdoc}
49    */
50   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
51     parent::buildOptionsForm($form, $form_state);
52
53     $fields = ['' => $this->t('<None>')];
54     $fields += $this->displayHandler->getFieldLabels(TRUE);
55
56     $form['title_field'] = [
57       '#type' => 'select',
58       '#title' => $this->t('Title field'),
59       '#options' => $fields,
60       '#required' => FALSE,
61       '#default_value' => $this->options['title_field'],
62       '#description' => $this->t('Select the field that will be used as the title.'),
63     ];
64
65   }
66
67 }