You are here

public function SwitchUserBlock::blockForm in Devel 4.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/Block/SwitchUserBlock.php \Drupal\devel\Plugin\Block\SwitchUserBlock::blockForm()
  2. 8 src/Plugin/Block/SwitchUserBlock.php \Drupal\devel\Plugin\Block\SwitchUserBlock::blockForm()
  3. 8.2 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) {
  $anonymous = 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' => $anonymous
        ->getDisplayName(),
    ]),
    '#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;
}