GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — 8.x-4.x ( 37109d...c8365a )
by Kevin
16:14
created

DefaultConfigLayout   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 19
dl 0
loc 49
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A defaultConfiguration() 0 4 1
A validateConfigurationForm() 0 1 1
A submitConfigurationForm() 0 3 1
A buildConfigurationForm() 0 12 1
A build() 0 6 2
1
<?php
2
3
namespace Drupal\df_tools_layout\Plugin\Layout;
4
5
use Drupal\Core\Form\FormStateInterface;
6
use Drupal\Core\Layout\LayoutDefault;
7
use Drupal\Core\Plugin\PluginFormInterface;
8
9
class DefaultConfigLayout extends LayoutDefault implements PluginFormInterface {
10
11
  /**
12
   * {@inheritdoc}
13
   */
14
  public function defaultConfiguration() {
15
    return [
16
      'class' => '',
17
      'full_width' => FALSE,
18
    ];
19
  }
20
21
  public function build(array $regions) {
22
    $build = parent::build($regions);
23
    if (!empty($this->configuration['class'])) {
24
      $build['#attributes']['class'][] = $this->configuration['class'];
25
    }
26
    return $build;
27
  }
28
29
  /**
30
   * {@inheritdoc}
31
   */
32
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
33
    $form['class'] = [
34
      '#type' => 'textfield',
35
      '#title' => $this->t('Extra Classes'),
36
      '#default_value' => $this->configuration['class'],
37
    ];
38
    $form['full_width'] = [
39
      '#type' => 'checkbox',
40
      '#title' => $this->t('Full width'),
41
      '#default_value' => $this->configuration['full_width'],
42
    ];
43
    return $form;
44
  }
45
46
  /**
47
   * {@inheritdoc}
48
   */
49
  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
50
  }
51
52
  /**
53
   * {@inheritdoc}
54
   */
55
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
56
    $this->configuration['class'] = $form_state->getValue('class');
57
    $this->configuration['full_width'] = $form_state->getValue('full_width');
58
  }
59
60
}
61