Files
wc-bootstrap/templates/global/form-login.html.twig
magdev 01b807a769 Implement Phase 1: global templates and notices (Bootstrap 5)
Add 9 Twig template overrides for WooCommerce's global and notice templates:
- global/wrapper-start, wrapper-end: conditional container with _theme_wrapped
- global/breadcrumb: Bootstrap breadcrumb component with aria-current
- global/sidebar: offcanvas-lg for mobile, standard aside for desktop
- global/quantity-input: input-group with +/- buttons
- global/form-login: responsive form with form-control, form-check
- notices/notice, error, success: Bootstrap alert-dismissible with icons

Supporting changes:
- assets/js/quantity.js: +/- button handler respecting min/max/step
- assets/css/wc-bootstrap.css: WooCommerce notice fallback styles, spinner removal
- functions.php: register quantity.js script

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:19:10 +01:00

90 lines
3.2 KiB
Twig

{#
# Global Login Form (Bootstrap 5 Override)
#
# Inline login form used on checkout and other pages (not the My Account login).
# Can be initially hidden and toggled via a link.
#
# Expected context (from WooCommerce wc_get_template('global/form-login.php')):
# hidden - Whether form is initially hidden (boolean)
# message - Optional message to display above the form
# redirect - URL to redirect after login
#
# WooCommerce PHP equivalent: global/form-login.php
#
# @package WcBootstrap
# @since 0.1.0
#}
{% if not is_user_logged_in() %}
<form class="woocommerce-form woocommerce-form-login login{% if hidden %} d-none{% endif %}" method="post">
{{ do_action('woocommerce_login_form_start') }}
{% if message %}
<div class="mb-3">
{{ message|wpautop }}
</div>
{% endif %}
<div class="row g-3 mb-3">
<div class="col-sm-6">
<label for="username" class="form-label">
{{ __('Username or email') }}&nbsp;<span class="text-danger" aria-hidden="true">*</span>
<span class="visually-hidden">{{ __('Required') }}</span>
</label>
<input type="text"
class="form-control"
name="username"
id="username"
autocomplete="username"
required
aria-required="true" />
</div>
<div class="col-sm-6">
<label for="password" class="form-label">
{{ __('Password') }}&nbsp;<span class="text-danger" aria-hidden="true">*</span>
<span class="visually-hidden">{{ __('Required') }}</span>
</label>
<input type="password"
class="form-control"
name="password"
id="password"
autocomplete="current-password"
required
aria-required="true" />
</div>
</div>
{{ do_action('woocommerce_login_form') }}
<div class="d-flex align-items-center justify-content-between flex-wrap gap-2">
<div class="form-check">
<input class="form-check-input"
type="checkbox"
name="rememberme"
id="rememberme"
value="forever" />
<label class="form-check-label" for="rememberme">
{{ __('Remember me') }}
</label>
</div>
{{ wp_nonce_field('woocommerce-login', 'woocommerce-login-nonce') }}
<input type="hidden" name="redirect" value="{{ redirect|esc_url }}" />
<button type="submit"
class="btn btn-primary"
name="login"
value="{{ __('Login') }}">
{{ __('Login') }}
</button>
</div>
<p class="mt-3 mb-0">
<a href="{{ wp_lostpassword_url()|esc_url }}">{{ __('Lost your password?') }}</a>
</p>
{{ do_action('woocommerce_login_form_end') }}
</form>
{% endif %}