You are here

public function TestRichTextBlock::blockForm in Lingotek Translation 4.0.x

Same name and namespace in other branches
  1. 3.3.x tests/modules/lingotek_test/src/Plugin/Block/TestRichTextBlock.php \Drupal\lingotek_test\Plugin\Block\TestRichTextBlock::blockForm()
  2. 3.4.x tests/modules/lingotek_test/src/Plugin/Block/TestRichTextBlock.php \Drupal\lingotek_test\Plugin\Block\TestRichTextBlock::blockForm()
  3. 3.5.x tests/modules/lingotek_test/src/Plugin/Block/TestRichTextBlock.php \Drupal\lingotek_test\Plugin\Block\TestRichTextBlock::blockForm()
  4. 3.6.x tests/modules/lingotek_test/src/Plugin/Block/TestRichTextBlock.php \Drupal\lingotek_test\Plugin\Block\TestRichTextBlock::blockForm()
  5. 3.7.x tests/modules/lingotek_test/src/Plugin/Block/TestRichTextBlock.php \Drupal\lingotek_test\Plugin\Block\TestRichTextBlock::blockForm()
  6. 3.8.x tests/modules/lingotek_test/src/Plugin/Block/TestRichTextBlock.php \Drupal\lingotek_test\Plugin\Block\TestRichTextBlock::blockForm()

Returns the configuration form elements specific to this block plugin.

Blocks that need to add form elements to the normal block configuration form should implement this method.

Parameters

array $form: The form definition array for the block configuration form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The renderable form array representing the entire configuration form.

Overrides BlockPluginTrait::blockForm

File

tests/modules/lingotek_test/src/Plugin/Block/TestRichTextBlock.php, line 23

Class

TestRichTextBlock
Provides a 'Lingotek Test Rich Text' block.

Namespace

Drupal\lingotek_test\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);
  $form['rich_text'] = [
    '#type' => 'text_format',
    '#title' => $this
      ->t('Rich text'),
    '#format' => isset($this->configuration['rich_text']['format']) ? $this->configuration['rich_text']['format'] : NULL,
    '#default_value' => isset($this->configuration['rich_text']['value']) ? $this->configuration['rich_text']['value'] : '',
  ];
  return $form;
}