Completed
Push — 8.x-1.x ( a890cc...7bd151 )
by Janez
02:20
created

FieldWidgetDisplayBase::isApplicable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Drupal\entity_browser;
4
5
use Drupal\Core\Entity\EntityTypeInterface;
6
use Drupal\Core\Form\FormStateInterface;
7
use Drupal\Core\Plugin\PluginBase;
8
9
/**
10
 * Base implementation for field widget display plugins.
11
 */
12
abstract class FieldWidgetDisplayBase extends PluginBase implements FieldWidgetDisplayInterface {
13
14
  /**
15
   * Constructs field widget display plugin.
16
   *
17
   * @param array $configuration
18
   *   A configuration array containing information about the plugin instance.
19
   * @param string $plugin_id
20
   *   The plugin_id for the plugin instance.
21
   * @param mixed $plugin_definition
22
   *   The plugin implementation definition.
23
   */
24
  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
25
    parent::__construct($configuration, $plugin_id, $plugin_definition);
26
    $this->setConfiguration($configuration);
27
  }
28
29
  /**
30
   * {@inheritdoc}
31
   */
32
  public function settingsForm(array $form, FormStateInterface $form_state) {
33
    return [];
34
  }
35
36
  /**
37
   * {@inheritdoc}
38
   */
39
  public function isApplicable(EntityTypeInterface $entity_type) {
40
    return TRUE;
41
  }
42
43
  /**
44
   * {@inheritdoc}
45
   */
46
  public function getConfiguration() {
47
    return $this->configuration;
48
  }
49
50
  /**
51
   * {@inheritdoc}
52
   */
53
  public function setConfiguration(array $configuration) {
54
    $configuration += $this->defaultConfiguration();
55
56
    $this->configuration = $configuration;
57
  }
58
59
  /**
60
   * {@inheritdoc}
61
   */
62
  public function calculateDependencies() {
63
    return [];
64
  }
65
66
  /**
67
   * {@inheritdoc}
68
   */
69
  public function defaultConfiguration() {
70
    return [];
71
  }
72
73
}
74