function UserLoginBlock::renderPlaceholderFormAction

Same name and namespace in other branches
  1. 9 core/modules/user/src/Plugin/Block/UserLoginBlock.php \Drupal\user\Plugin\Block\UserLoginBlock::renderPlaceholderFormAction()
  2. 8.9.x core/modules/user/src/Plugin/Block/UserLoginBlock.php \Drupal\user\Plugin\Block\UserLoginBlock::renderPlaceholderFormAction()
  3. 10 core/modules/user/src/Plugin/Block/UserLoginBlock.php \Drupal\user\Plugin\Block\UserLoginBlock::renderPlaceholderFormAction()

Render API callback: Renders a form action URL including destination.

This function is assigned as a #lazy_builder callback.

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 164

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.