Completed
Pull Request — 8.x-1.x (#126)
by Janez
02:11
created

WidgetSelectorBase::defaultConfiguration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * @file
5
 * Contains \Drupal\entity_browser\WidgetSelectorBase.
6
 */
7
8
namespace Drupal\entity_browser;
9
10
use Drupal\Core\Plugin\PluginBase;
11
use Drupal\Core\Form\FormStateInterface;
12
13
/**
14
 * Base class for widget selector plugins.
15
 */
16
abstract class WidgetSelectorBase extends PluginBase implements WidgetSelectorInterface {
17
18
  use PluginConfigurationFormTrait;
19
20
  /**
21
   * Plugin label.
22
   *
23
   * @var string
24
   */
25
  protected $label;
26
27
  /**
28
   * Available widgets.
29
   *
30
   * @var array()
31
   */
32
  protected $widgets_options;
33
34
  /**
35
   * ID of the default widget.
36
   *
37
   * @var string
38
   */
39
  protected $defaultWidget;
40
41
  /**
42
   * {@inheritdoc}
43
   */
44
  public function __construct($configuration, $plugin_id, $plugin_definition) {
45
    parent::__construct($configuration, $plugin_id, $plugin_definition);
46
    $this->widget_ids = $this->configuration['widget_ids'];
47
  }
48
49
  /**
50
   * {@inheritdoc}
51
   */
52
  public function defaultConfiguration() {
53
    return [];
54
  }
55
56
  /**
57
   * {@inheritdoc}
58
   */
59
  public function getConfiguration() {
60
    return $this->configuration;
61
  }
62
63
  /**
64
   * {@inheritdoc}
65
   */
66
  public function setConfiguration(array $configuration) {
67
    $this->configuration = $configuration;
68
  }
69
70
  /**
71
   * {@inheritdoc}
72
   */
73
  public function calculateDependencies() {
74
    return [];
75
  }
76
77
  /**
78
   * {@inheritdoc}
79
   */
80
  public function label() {
81
    return $this->label;
82
  }
83
84
  /**
85
   * {@inheritdoc}
86
   */
87
  protected function getDefaultWidget() {
88
    return $this->defaultWidget;
89
  }
90
91
  /**
92
   * {@inheritdoc}
93
   */
94
  public function setDefaultWidget($widget) {
95
    $this->defaultWidget = $widget;
96
  }
97
98
  /**
99
   * {@inheritdoc}
100
   */
101
  public function validate(array &$form, FormStateInterface $form_state) {}
102
103
  /**
104
   * {@inheritdoc}
105
   */
106
  public function submit(array &$form, FormStateInterface $form_state) {}
107
108
}
109