NoDisplay   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getForm() 0 3 1
A submit() 0 7 2
1
<?php
2
3
namespace Drupal\entity_browser\Plugin\EntityBrowser\SelectionDisplay;
4
5
use Drupal\Core\Form\FormStateInterface;
6
use Drupal\entity_browser\SelectionDisplayBase;
7
8
/**
9
 * Does not show current selection and immediately delivers selected entities.
10
 *
11
 * @EntityBrowserSelectionDisplay(
12
 *   id = "no_display",
13
 *   label = @Translation("No selection display"),
14
 *   description = @Translation("Skips the current selection display and immediately delivers the entities selected."),
15
 *   acceptPreselection = FALSE,
16
 *   js_commands = FALSE
17
 * )
18
 */
19
class NoDisplay extends SelectionDisplayBase {
20
21
  /**
22
   * {@inheritdoc}
23
   */
24
  public function getForm(array &$original_form, FormStateInterface $form_state) {
25
    return [];
26
  }
27
28
  /**
29
   * {@inheritdoc}
30
   */
31
  public function submit(array &$form, FormStateInterface $form_state) {
32
    // Only finish selection if the form was submitted using main submit
33
    // element. This allows widgets to build multi-step workflows.
34
    if (!empty($form_state->getTriggeringElement()['#eb_widget_main_submit'])) {
35
      $this->selectionDone($form_state);
36
    }
37
  }
38
39
}
40