You are here

public function PrevNextBlock::blockForm in Previous/Next API 8.2

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/PrevNextBlock.php, line 101

Class

PrevNextBlock
Provides a 'Previous Next' block.

Namespace

Drupal\prev_next\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form['previous'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Previous Node'),
    '#open' => TRUE,
    '#tree' => TRUE,
  ];
  $form['previous']['prev_display'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Display'),
    '#default_value' => $this->configuration['prev_display'],
  ];
  $form['previous']['prev_text'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Link text'),
    '#description' => $this
      ->t('Provide the text to customize the previous link text.'),
    '#default_value' => $this->configuration['prev_text'],
  ];
  $form['next'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Next Node'),
    '#open' => TRUE,
    '#tree' => TRUE,
  ];
  $form['next']['next_display'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Display'),
    '#default_value' => $this->configuration['next_display'],
  ];
  $form['next']['next_text'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Link text'),
    '#description' => $this
      ->t('Provide the text to customize the next link text.'),
    '#default_value' => $this->configuration['next_text'],
  ];
  return $form;
}