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.

TextWithTabWidget::formElement()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 5
1
<?php
2
3
namespace Drupal\df_tools_tabs\Plugin\Field\FieldWidget;
4
5
use Drupal\Core\Form\FormStateInterface;
6
use Drupal\text\Plugin\Field\FieldWidget\TextareaWidget;
7
use Drupal\Core\Field\FieldItemListInterface;
8
9
/**
10
 * Plugin implementation of the 'text_with_tab' widget.
11
 *
12
 * @FieldWidget(
13
 *   id = "text_with_tab",
14
 *   label = @Translation("Text with tab"),
15
 *   field_types = {
16
 *     "text_with_tab"
17
 *   }
18
 * )
19
 */
20
class TextWithTabWidget extends TextareaWidget {
21
22
  /**
23
   * {@inheritdoc}
24
   */
25
  function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
26
    $element = parent::formElement($items, $delta, $element, $form, $form_state);
27
28
    $element['tab_title'] = [
29
      '#type' => 'textfield',
30
      '#default_value' => $items[$delta]->tab_title,
31
      '#title' => $this->t('Tab Title'),
32
      '#description' => $this->t('The tab title.'),
33
      '#weight' => -10,
34
    ];
35
36
    return $element;
37
  }
38
39
}
40