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.
Completed
Push — 8.x-2.x ( 26312f...98ec6b )
by Brant
03:47
created

CodeBlock::blockSubmit()   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
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Drupal\df_tools_blocks\Plugin\Block;
4
5
use Drupal\Core\Block\BlockBase;
6
use Drupal\Core\Form\FormStateInterface;
7
8
/**
9
 * Provides a 'CodeBlock' block.
10
 *
11
 * @Block(
12
 *  id = "code_block",
13
 *  admin_label = @Translation("Code block"),
14
 * )
15
 */
16
class CodeBlock extends BlockBase {
17
18
19
  /**
20
   * {@inheritdoc}
21
   */
22
  public function defaultConfiguration() {
23
    return [
24
         'code' => $this->t(''),
25
        ] + parent::defaultConfiguration();
26
 }
27
28
  /**
29
   * {@inheritdoc}
30
   */
31
  public function blockForm($form, FormStateInterface $form_state) {
32
    $form['code'] = [
33
      '#type' => 'textarea',
34
      '#title' => $this->t('Code'),
35
      '#description' => $this->t('Add javascript or html code.'),
36
      '#default_value' => $this->configuration['code'],
37
      '#weight' => '0',
38
    ];
39
40
    return $form;
41
  }
42
43
  /**
44
   * {@inheritdoc}
45
   */
46
  public function blockSubmit($form, FormStateInterface $form_state) {
47
    $this->configuration['code'] = $form_state->getValue('code');
48
  }
49
50
  /**
51
   * {@inheritdoc}
52
   */
53
  public function build() {
54
    return ['code_block_code' => ['#markup' => $this->configuration['code']]];
55
  }
56
57
}
58