You are here

public function SecureLoginManager::userLoginBlockPreRender in Secure Login 8

Pre-render callback to re-secure the user login block.

File

src/SecureLoginManager.php, line 156

Class

SecureLoginManager
Defines the secure login service.

Namespace

Drupal\securelogin

Code

public function userLoginBlockPreRender($build) {
  if (!empty($build['content']['user_login_form']['#https'])) {
    $this
      ->secureForm($build['content']['user_login_form']);

    // Handle Drupal 8.4 style action placeholder.
    $placeholder = 'form_action_p_4r8ITd22yaUvXM6SzwrSe9rnQWe48hz9k1Sxto3pBvE';
    if (isset($build['content']['user_login_form']['#attached']['placeholders'][$placeholder])) {
      $build['content']['user_login_form']['#attached']['placeholders'][$placeholder] = [
        '#lazy_builder' => [
          'securelogin.manager:renderPlaceholderFormAction',
          [],
        ],
      ];
    }
  }
  return $build;
}