You are here

public static function UserLoginBlock::renderPlaceholderFormAction in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/Block/UserLoginBlock.php \Drupal\user\Plugin\Block\UserLoginBlock::renderPlaceholderFormAction()

#lazy_builder callback; renders a form action URL including destination.

Return value

array A renderable array representing the form action.

See also

\Drupal\Core\Form\FormBuilder::renderPlaceholderFormAction()

File

core/modules/user/src/Plugin/Block/UserLoginBlock.php, line 156

Class

UserLoginBlock
Provides a 'User login' block.

Namespace

Drupal\user\Plugin\Block

Code

public static function renderPlaceholderFormAction() {
  return [
    '#type' => 'markup',
    '#markup' => UrlHelper::filterBadProtocol(Url::fromRoute('<current>', [], [
      'query' => \Drupal::destination()
        ->getAsArray(),
      'external' => FALSE,
    ])
      ->toString()),
    '#cache' => [
      'contexts' => [
        'url.path',
        'url.query_args',
      ],
    ],
  ];
}