You are here

public function TagcloudsTermsBlock::blockForm in TagCloud 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Block/TagcloudsTermsBlock.php \Drupal\tagclouds\Plugin\Block\TagcloudsTermsBlock::blockForm()
  2. 1.0.x src/Plugin/Block/TagcloudsTermsBlock.php \Drupal\tagclouds\Plugin\Block\TagcloudsTermsBlock::blockForm()

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/TagcloudsTermsBlock.php, line 103

Class

TagcloudsTermsBlock
Provides a template for blocks based of each vocabulary.

Namespace

Drupal\tagclouds\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $terms_limit = isset($this->configuration['tags']) ? $this->configuration['tags'] : 0;
  $vocabulary = isset($this->configuration['vocabulary']) ? $this->configuration['vocabulary'] : 'tags';
  $form['tags'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Tags to show'),
    '#default_value' => $terms_limit,
    '#maxlength' => 3,
    '#description' => $this
      ->t("The number of tags to show in this block. Enter '0' to display all tags."),
  ];
  $form['vocabulary'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Vocabulary machine name'),
    '#default_value' => $vocabulary,
  ];
  return $form;
}