| Total Complexity | 4 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class CodeBlock extends BlockBase { |
||
| 17 | |||
| 18 | |||
| 19 | /** |
||
| 20 | * {@inheritdoc} |
||
| 21 | */ |
||
| 22 | public function defaultConfiguration() { |
||
| 23 | return ['code' => $this->t('')] + parent::defaultConfiguration(); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * {@inheritdoc} |
||
| 28 | */ |
||
| 29 | public function blockForm($form, FormStateInterface $form_state) { |
||
| 30 | $form['code'] = [ |
||
| 31 | '#title' => $this->t('Code'), |
||
| 32 | '#type' => 'text_format', |
||
| 33 | '#format' => 'full_html', |
||
| 34 | '#description' => $this->t('Add javascript or html code.'), |
||
| 35 | '#default_value' => $this->configuration['code']['value'], |
||
| 36 | '#weight' => '6', |
||
| 37 | ]; |
||
| 38 | |||
| 39 | return $form; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * {@inheritdoc} |
||
| 44 | */ |
||
| 45 | public function blockSubmit($form, FormStateInterface $form_state) { |
||
| 46 | $this->configuration['code'] = $form_state->getValue('code'); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * {@inheritdoc} |
||
| 51 | */ |
||
| 52 | public function build() { |
||
| 54 | } |
||
| 55 | |||
| 56 | } |
||
| 57 | |||
| 58 |