You are here

public function CctagsBlock::blockForm in cctags 8

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/CctagsBlock.php, line 90

Class

CctagsBlock
Provides a 'cctags' block.

Namespace

Drupal\cctags\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $form = parent::blockForm($form, $form_state);
  $config = $this
    ->getConfiguration();
  $form['level'] = array(
    '#type' => 'select',
    '#options' => _cctags_get_select_list('level'),
    '#title' => $this
      ->t('Number of levels fonts metrics'),
    '#default_value' => isset($config['level']) ? $config['level'] : '',
    '#description' => $this
      ->t('The number of levels between the least popular tags and the most popular ones. Different levels will be assigned a different class to be themed in cctags.css'),
  );
  $form['tags'] = array(
    '#type' => 'select',
    '#title' => 'Tags to show',
    '#options' => _cctags_get_select_list('numtags'),
    '#default_value' => isset($config['tags']) ? $config['tags'] : '',
    '#maxlength' => 3,
    '#description' => $this
      ->t('The number of tags to show in this block.'),
  );
  $op_sort = array(
    'level,asc' => $this
      ->t('by level, ascending'),
    'level,desc' => $this
      ->t('by level, descending'),
    'title,asc' => $this
      ->t('by title, ascending'),
    'title,desc' => $this
      ->t('by title, descending'),
    'random,none' => $this
      ->t('random'),
  );
  $form['tags_sort'] = array(
    '#type' => 'radios',
    '#title' => $this
      ->t('Tags sort order'),
    '#options' => $op_sort,
    '#default_value' => isset($config['tags_sort']) ? $config['tags_sort'] : '',
  );
  $form['extra_class'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Block wrapper extra class'),
    '#maxlength' => 64,
    '#description' => $this
      ->t('Extra class for block wrapper.'),
    '#default_value' => isset($config['extra_class']) ? $config['extra_class'] : '',
  );
  $form['tags_more'] = array(
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable more link of end block'),
    '#default_value' => isset($config['tags_more']) ? $config['tags_more'] : false,
  );
  return $form;
}