Completed
Pull Request — 8.x-1.x (#148)
by
unknown
02:42
created

Standalone   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 7
c 5
b 0
f 1
lcom 0
cbo 1
dl 0
loc 62
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A displayEntityBrowser() 0 3 1
A selectionCompleted() 0 3 1
A path() 0 3 1
A getUuid() 0 3 1
A setUuid() 0 3 1
A buildConfigurationForm() 0 11 1
A defaultConfiguration() 0 5 1
1
<?php
2
3
/**
4
 * Contains \Drupal\entity_browser\Plugin\EntityBrowser\Display\Standalone.
5
 */
6
7
namespace Drupal\entity_browser\Plugin\EntityBrowser\Display;
8
9
use Drupal\entity_browser\DisplayBase;
10
use Drupal\entity_browser\DisplayRouterInterface;
11
use Drupal\Core\Form\FormStateInterface;
12
13
/**
14
 * Presents entity browser as a standalone form.
15
 *
16
 * @EntityBrowserDisplay(
17
 *   id = "standalone",
18
 *   label = @Translation("Standalone form"),
19
 *   description = @Translation("Displays entity browser as a standalone form."),
20
 *   uses_route = TRUE
21
 * )
22
 */
23
class Standalone extends DisplayBase implements DisplayRouterInterface {
24
25
  /**
26
   * {@inheritdoc}
27
   */
28
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
29
    $form['path'] = [
30
      '#type' => 'textfield',
31
      '#title' => $this->t('Path'),
32
      '#required' => TRUE,
33
      '#description' => $this->t('The path at which the browser will be accessible. Must begin with a forward slash.'),
34
      '#default_value' => $this->configuration['path'],
35
    ];
36
37
    return $form;
38
  }
39
40
  /**
41
   * {@inheritdoc}
42
   */
43
  public function defaultConfiguration() {
44
    return [
45
      'path' => '',
46
    ];
47
  }
48
49
  /**
50
   * {@inheritdoc}
51
   */
52
  public function displayEntityBrowser(FormStateInterface $form_state) {
53
    // @TODO Implement it.
54
  }
55
56
  /**
57
   * {@inheritdoc}
58
   */
59
  public function selectionCompleted(array $entities) {
60
    // @TODO Implement it.
61
  }
62
63
  /**
64
   * {@inheritdoc}
65
   */
66
  public function path() {
67
    return $this->configuration['path'];
68
  }
69
70
  /**
71
   * {@inheritdoc}
72
   */
73
  public function getUuid() {
74
    return '';
75
  }
76
77
  /**
78
   * {@inheritdoc}
79
   */
80
  public function setUuid($uuid) {
81
    // @TODO Implement it.
82
  }
83
84
}
85