function UserLoginBlock::renderPlaceholderFormAction

Same name in other branches
  1. 8.9.x core/modules/user/src/Plugin/Block/UserLoginBlock.php \Drupal\user\Plugin\Block\UserLoginBlock::renderPlaceholderFormAction()
  2. 10 core/modules/user/src/Plugin/Block/UserLoginBlock.php \Drupal\user\Plugin\Block\UserLoginBlock::renderPlaceholderFormAction()
  3. 11.x 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',
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.