You are here

public function SwitchUserBlock::blockForm in Devel 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/Block/SwitchUserBlock.php \Drupal\devel\Plugin\Block\SwitchUserBlock::blockForm()
  2. 8.2 src/Plugin/Block/SwitchUserBlock.php \Drupal\devel\Plugin\Block\SwitchUserBlock::blockForm()
  3. 4.x src/Plugin/Block/SwitchUserBlock.php \Drupal\devel\Plugin\Block\SwitchUserBlock::blockForm()

Overrides BlockPluginTrait::blockForm

File

src/Plugin/Block/SwitchUserBlock.php, line 111

Class

SwitchUserBlock
Provides a block for switching users.

Namespace

Drupal\devel\Plugin\Block

Code

public function blockForm($form, FormStateInterface $form_state) {
  $anononymous = new AnonymousUserSession();
  $form['list_size'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Number of users to display in the list'),
    '#default_value' => $this->configuration['list_size'],
    '#min' => 1,
    '#max' => 50,
  ];
  $form['include_anon'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Include %anonymous', [
      '%anonymous' => $anononymous
        ->getAccountName(),
    ]),
    '#default_value' => $this->configuration['include_anon'],
  ];
  $form['show_form'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Allow entering any user name'),
    '#default_value' => $this->configuration['show_form'],
  ];
  return $form;
}