You are here

public function OpenReadspeakerBlock::blockForm in Open ReadSpeaker 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/OpenReadspeakerBlock.php, line 58

Class

OpenReadspeakerBlock
Provides a 'OpenReadspeakerBlock' block.

Namespace

Drupal\open_readspeaker\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form['open_readspeaker_buttonstyle'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Class of button'),
    '#description' => $this
      ->t('Write class name of the button. You can add multiple calsses by space.'),
    '#default_value' => isset($this->configuration['open_readspeaker_buttonstyle']) ? $this->configuration['open_readspeaker_buttonstyle'] : 'open-readspeaker-button',
  ];
  $form['open_readspeaker_buttontext'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Button text'),
    '#description' => $this
      ->t('Please write button text here.'),
    '#default_value' => isset($this->configuration['open_readspeaker_buttontext']) ? $this->configuration['open_readspeaker_buttontext'] : $this
      ->t('Listen'),
  ];
  $form['open_readspeaker_buttontitle'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Button title'),
    '#description' => $this
      ->t('Specify the title attribute for the ReadSpeaker button.'),
    '#default_value' => isset($this->configuration['open_readspeaker_buttontitle']) ? $this->configuration['open_readspeaker_buttontitle'] : $this
      ->t('Listen to this page using ReadSpeaker'),
  ];
  $form['open_readspeaker_reading_area'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Reading area ID'),
    '#description' => $this
      ->t('Specify content using HTML ID attribute.'),
    '#default_value' => isset($this->configuration['open_readspeaker_reading_area']) ? $this->configuration['open_readspeaker_reading_area'] : '',
    '#required' => TRUE,
  ];
  $form['open_readspeaker_reading_area_class'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Reading area of classes'),
    '#description' => t('Specify content using HTML Class attribute(s). For multiple classes use format: class1,class2,class3'),
    '#default_value' => isset($this->configuration['open_readspeaker_reading_area_class']) ? $this->configuration['open_readspeaker_reading_area_class'] : '',
  ];
  return $form;
}