Initial commit: Grav CMS setup with HTML reference material
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
{# DEPRECATED: Do not override this file! Use forms/layouts/button/[FORM_LAYOUT]-button.html.twig instead #}
|
||||
|
||||
{% set layout = layout ?? form.layout ?? 'default' %}
|
||||
{% extends ["forms/layouts/button/#{layout}-button.html.twig", 'forms/layouts/button/default-button.html.twig'] %}
|
||||
@@ -0,0 +1,12 @@
|
||||
{% set button_tag %}
|
||||
<button
|
||||
{% block embed_button_core %}{% endblock %}
|
||||
{% block embed_button_classes %}{% endblock %}
|
||||
>{%- block embed_button_content -%}{%- endblock -%}</button>
|
||||
{% endset %}
|
||||
|
||||
{% if button_url %}
|
||||
<a href="{{ button_url|e }}">{{ button_tag|trim|raw }}</a>
|
||||
{% else %}
|
||||
{{ button_tag|trim|raw }}
|
||||
{% endif %}
|
||||
@@ -0,0 +1 @@
|
||||
{% block field_input_classes %}{% endblock %}
|
||||
@@ -0,0 +1,4 @@
|
||||
{# DEPRECATED: Do not override this file! Use forms/layouts/field/[FORM_LAYOUT]-field.html.twig instead #}
|
||||
|
||||
{% set layout = layout ?? form.layout ?? 'default' %}
|
||||
{% extends ["forms/layouts/field/#{layout}-field.html.twig", 'forms/layouts/field/default-field.html.twig'] %}
|
||||
@@ -0,0 +1,53 @@
|
||||
{% block field %}
|
||||
<div class="form-field {{ layout_form_field_outer_classes|trim }} {{ form_field_outer_core|trim}}">
|
||||
{% block contents %}
|
||||
{% if show_label %}
|
||||
<div class="{{- layout_form_field_outer_label_classes -}}">
|
||||
{{- form_field_toggleable -}}
|
||||
<label class="{{ layout_form_field_label_classes }}{{ form_field_label_trim }}" {% if field.id %}for="{{ form_field_for }}"{% endif %}>
|
||||
{%- block label -%}
|
||||
{%- if form_field_help -%}
|
||||
<span class="tooltip" data-tooltip="{{ form_field_help|e }}">{{ form_field_label|raw }}</span>
|
||||
{%- else -%}
|
||||
{{ form_field_label|raw }}
|
||||
{%- endif -%}
|
||||
{%- if form_field_required %}
|
||||
<span class="required">*</span>
|
||||
{%- endif -%}
|
||||
{%- endblock -%}
|
||||
</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="{{ layout_form_field_outer_data_classes }}"
|
||||
{% block global_attributes %}{% endblock %}
|
||||
>
|
||||
{% block group %}
|
||||
{% block input %}
|
||||
<div class="{{ layout_form_field_wrapper_classes }} {{ field.size }}">
|
||||
{% block prepend %}{% endblock prepend %}
|
||||
{% set input_value = value is iterable ? value|join(',') : value|string %}
|
||||
<input
|
||||
name="{{ (scope ~ field.name)|fieldName }}"
|
||||
value="{{ input_value|e }}"
|
||||
{% block input_attributes %}{% endblock %}
|
||||
/>
|
||||
{% block append %}{% endblock append %}
|
||||
{% if inline_errors and errors %}
|
||||
<div class="{{ form_field_inline_error_classes }}">
|
||||
<p class="form-message"><i class="fa fa-exclamation-circle"></i> {{ errors|first|raw }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
{% if field.description is defined %}
|
||||
<div class="{{ form_field_extra_wrapper_classes }}">
|
||||
<span class="form-description">
|
||||
{{ form_field_description|raw }}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,4 @@
|
||||
{# DEPRECATED: Do not override this file! Use forms/layouts/form/[FORM_LAYOUT]-form.html.twig instead #}
|
||||
|
||||
{% set layout = layout ?? form.layout ?? 'default' %}
|
||||
{% extends ["forms/layouts/form/#{layout}-form.html.twig", 'forms/layouts/form/default-form.html.twig'] %}
|
||||
@@ -0,0 +1,9 @@
|
||||
<form
|
||||
{% block embed_form_core %}{% endblock %}
|
||||
{% block embed_form_classes %}{% endblock %}
|
||||
{% block embed_form_custom_attributes %}{% endblock %}
|
||||
>
|
||||
{% block embed_fields %}{% endblock %}
|
||||
{% block embed_buttons %}{% endblock %}
|
||||
</form>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
{% if form.xhr_submit == true %}
|
||||
{# Ensure xhr-submitter.js is loaded BEFORE the inline JS that uses it #}
|
||||
{% do assets.addJs('plugin://form/assets/xhr-submitter.js', {'group': 'bottom', 'priority': 101, 'position': 'before'}) %}
|
||||
{% do assets.addInlineJs("
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// This now primarily sets up the *potential* for XHR submission
|
||||
// It might not attach the listener directly if recaptcha is present
|
||||
attachFormSubmitListener('" ~ form.id ~ "');
|
||||
|
||||
// Re-run captcha initializers *if* the form was loaded via XHR initially
|
||||
// This covers edge cases, might not be strictly needed if captcha script handles DOMContentLoaded
|
||||
const formElement = document.getElementById('" ~ form.id ~ "');
|
||||
if (formElement && window.GravRecaptchaInitializers) {
|
||||
const initializerFuncName = 'initRecaptcha_" ~ form.id ~ "';
|
||||
if (typeof window.GravRecaptchaInitializers[initializerFuncName] === 'function') {
|
||||
// Check if it needs init (e.g., if container exists but no widget/listener)
|
||||
// For simplicity, just call it again; the init function should be idempotent
|
||||
// window.GravRecaptchaInitializers[initializerFuncName]();
|
||||
}
|
||||
}
|
||||
});",
|
||||
{'group': 'bottom', 'priority': 100, 'position': 'before'}) %}
|
||||
{% do assets.addJs('plugin://form/assets/captcha/recaptcha-handler.js', {'group': 'bottom', 'priority': 99, 'position': 'before'}) %}
|
||||
{% do assets.addJs('plugin://form/assets/captcha/turnstile-handler.js', {'group': 'bottom', 'priority': 98, 'position': 'before'}) %}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user