You are here

public function CopyrightBlock::blockForm in Copyright Block module 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/CopyrightBlock.php, line 66

Class

CopyrightBlock
Adds a copyright block.

Namespace

Drupal\copyright_block\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);
  $config = $this
    ->getConfiguration();
  $form['start_year'] = [
    '#title' => $this
      ->t('Start year'),
    '#type' => 'number',
    '#min' => '1900',
    '#max' => date('Y'),
    '#required' => TRUE,
    '#default_value' => $config['start_year'],
  ];
  $form['separator'] = [
    '#title' => $this
      ->t('Separator'),
    '#type' => 'textfield',
    '#required' => TRUE,
    '#default_value' => $config['separator'],
  ];
  $form['text'] = [
    '#title' => $this
      ->t('Copyright statement text'),
    '#type' => 'text_format',
    '#required' => TRUE,
    '#default_value' => $config['text']['value'],
    '#format' => $config['text']['format'],
  ];
  $form['token_tree'] = [
    '#theme' => 'token_tree_link',
  ];
  return $form;
}