You are here

public function UserRegisterBlock::build in Form Block 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Block/UserRegisterBlock.php \Drupal\formblock\Plugin\Block\UserRegisterBlock::build()

Implements \Drupal\block\BlockBase::build().

Overrides BlockPluginInterface::build

File

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

Class

UserRegisterBlock
Provides a block for the user registration form.

Namespace

Drupal\formblock\Plugin\Block

Code

public function build() {
  $build = [];
  $account = $this->entityTypeManager
    ->getStorage('user')
    ->create([]);
  $build['form'] = $this->entityFormBuilder
    ->getForm($account, $this->configuration['form_mode']);
  return $build;
}