Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
You can either get the login form from the formBuilder in your block's build() method, pass it to the template, and render where you want. See Drupal\user\Plugin\Block\UserLoginBlock for an example.
Or just render the 'user_login_block' inside your block like so:
$block_manager = \Drupal::service('plugin.manager.block');
$config = [];
$plugin_block = $block_manager->createInstance('system_breadcrumb_block', $config);
$access_result = $plugin_block->access(\Drupal::currentUser());
if (is_object($access_result) && $access_result->isForbidden() || is_bool($access_result) && !$access_result) {
return [];
}
$render = $plugin_block->build();
return $render;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question