<?php

$authHelpContext = is_array($authHelpContext ?? null) ? $authHelpContext : [];
$showForgot = !empty($authHelpContext['show_forgot']);
$showRegister = !empty($authHelpContext['show_register']) && allowRegistration();
$showBackToLogin = !empty($authHelpContext['show_back_to_login']);

$links = [];
if ($showForgot) {
    $links[] = ['href' => lurl('password/forgot'), 'label' => t('Forgot password')];
}
if ($showRegister) {
    $links[] = ['href' => lurl('register'), 'label' => t('Register')];
}
if ($showBackToLogin) {
    $links[] = ['href' => lurl('login'), 'label' => t('Back to login')];
}

if (!$links) {
    return;
}
?>
<nav class="login-help-links" aria-label="<?php e(t('Support')); ?>">
  <ul class="login-help-links-list">
    <?php foreach ($links as $link): ?>
      <li class="login-help-links-item">
        <a href="<?php e((string) ($link['href'] ?? '')); ?>"><?php e((string) ($link['label'] ?? '')); ?></a>
      </li>
    <?php endforeach; ?>
  </ul>
</nav>
