You are here

protected function UserRegisterBlock::getFormModes in Form Block 2.0.x

Get an array of user form modes.

Return value

array An array of form modes keyed by machine name.

1 call to UserRegisterBlock::getFormModes()
UserRegisterBlock::blockForm in src/Plugin/Block/UserRegisterBlock.php
Overrides \Drupal\block\BlockBase::blockForm().

File

src/Plugin/Block/UserRegisterBlock.php, line 148

Class

UserRegisterBlock
Provides a block for the user registration form.

Namespace

Drupal\formblock\Plugin\Block

Code

protected function getFormModes() {
  $options = [
    'default' => $this
      ->t('Default'),
  ];
  foreach ($this->entityDisplayRepository
    ->getFormModes('user') as $index => $mode) {
    $options[$index] = $mode['label'];
  }
  return $options;
}