Skip to content

Commit

Permalink
Merge branch 'release/7.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Oct 28, 2024
2 parents 3d9a79d + 26fcdbe commit 3ae7e59
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 30 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v7.4.2
## 10/28/2024

1. [](#improved)
* Enhanced the `input` tag to include a disabled attribute [$601](https://github.com/getgrav/grav-plugin-form/pull/601)
* Updated logging methods to support Monolog2+

# v7.4.1
## 10/22/2024

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Form
slug: form
type: plugin
version: 7.4.1
version: 7.4.2
description: Enables forms handling and processing
icon: check-square
author:
Expand Down
8 changes: 4 additions & 4 deletions form.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public function onFormProcessed(Event $event): void
'message' => $message
]));

$this->grav['log']->addWarning('Form reCAPTCHA Errors: [' . $uri->route() . '] ' . json_encode($errors));
$this->grav['log']->warning('Form reCAPTCHA Errors: [' . $uri->route() . '] ' . json_encode($errors));

$event->stopPropagation();

Expand Down Expand Up @@ -556,7 +556,7 @@ public function onFormProcessed(Event $event): void
'message' => $message
]));

$this->grav['log']->addWarning('Form Turnstile invalid: [' . $uri->route() . '] ' . json_encode($content));
$this->grav['log']->warning('Form Turnstile invalid: [' . $uri->route() . '] ' . json_encode($content));
$event->stopPropagation();
return;
}
Expand Down Expand Up @@ -1262,7 +1262,7 @@ protected function loadCachedForms(): void
if ($forms) {
$this->forms = Utils::arrayMergeRecursiveUnique($this->forms, $forms);
if ($this->config()['debug']) {
$this->grav['log']->addDebug(sprintf("<<<< Loaded cached forms: %s\n%s", $this->getFormCacheId(), $this->arrayToString($this->forms)));
$this->grav['log']->debug(sprintf("<<<< Loaded cached forms: %s\n%s", $this->getFormCacheId(), $this->arrayToString($this->forms)));
}

}
Expand All @@ -1286,7 +1286,7 @@ protected function saveCachedForms(): void

$cache->save($cache_id, $this->forms);
if ($this->config()['debug']) {
$this->grav['log']->addDebug(sprintf(">>>> Saved cached forms: %s\n%s", $this->getFormCacheId(), $this->arrayToString($this->forms)));
$this->grav['log']->debug(sprintf(">>>> Saved cached forms: %s\n%s", $this->getFormCacheId(), $this->arrayToString($this->forms)));
}
}

Expand Down
50 changes: 25 additions & 25 deletions templates/forms/fields/checkboxes/checkboxes.html.twig
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@
{% set value = field.default|merge(value) %}
{% endif %}

{% for key, text in field.options %}

{% set id = field.id|default(field.name)|hyphenize ~ '-' ~ key %}
{% set name = field.use == 'keys' ? key : id %}
{% set val = field.use == 'keys' ? '1' : key %}
{% set checked = (field.use == 'keys' ? value[key] : key in value) %}
{% set help = (key in field.help_options|keys ? field.help_options[key] : false) %}

<div class="checkboxes {{ form_field_wrapper_classes }} {{ field.wrapper_classes }}">
<input type="checkbox"
id="{{ id|e }}"
value="{{ val|e }}"
name="{{ (scope ~ field.name)|fieldName ~ '[' ~ name ~ ']' }}"
class="{{ form_field_checkbox_classes }} {{ field.classes }}"
{% if checked %}checked="checked"{% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
>
<label style="display: inline" for="{{ id|e }}">
{% if help %}
<span class="hint--bottom" data-hint="{{ help|t|e('html_attr') }}">{{ text|t|e }}</span>
{% else %}
{{ text|t|e }}
{% endif %}
</label>
{% for key, text in field.options %}
{% set id = field.id|default(field.name)|hyphenize ~ '-' ~ key %}
{% set name = field.use == 'keys' ? key : id %}
{% set val = field.use == 'keys' ? '1' : key %}
{% set checked = (field.use == 'keys' ? value[key] : key in value) %}
{% set help = (key in field.help_options|keys ? field.help_options[key] : false) %}
{% set disabled = key in field.disabled_options %}
<input type="checkbox"
id="{{ id|e }}"
value="{{ val|e }}"
name="{{ (scope ~ field.name)|fieldName ~ '[' ~ name ~ ']' }}"
class="{{ form_field_checkbox_classes }} {{ field.classes }}"
{% if checked %}checked="checked"{% endif %}
{% if disabled %}disabled="disabled"{% endif %}
>
<label style="display: inline; {% if disabled %}opacity: 0.6; cursor: no-drop;{% endif %}" for="{{ id|e }}">
{% if help %}
<span class="hint--bottom" data-hint="{{ help|t|e('html_attr') }}">{{ text|t|e }}</span>
{% else %}
{{ text|t|e }}
{% endif %}
</label>
{% endfor %}
</div>
{% endfor %}
{% endblock %}

{% endblock %}

0 comments on commit 3ae7e59

Please sign in to comment.