function 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;
}