Skip to content

Commit

Permalink
Merge branch 'release/7.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Jun 21, 2023
2 parents a450414 + d25170f commit 11aa715
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v7.2.0
## 06/21/2023

1. [](#bugfix)
* Fixed a long-standing bug with cached forms not working properly in multi-language scenarios

# v7.1.3
## 05/09/2023

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.1.3
version: 7.2.0
description: Enables forms handling and processing
icon: check-square
author:
Expand Down
19 changes: 2 additions & 17 deletions form.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ class FormPlugin extends Plugin
protected $active_forms = [];
/** @var array */
protected $json_response = [];
/** @var bool */
protected $recache_forms = false;

/**
* @return bool
Expand Down Expand Up @@ -223,11 +221,6 @@ public function onPageInitialized(): void
$submitted = false;
$this->json_response = [];

// Save cached forms.
if ($this->recache_forms) {
$this->saveCachedForms();
}

/** @var PageInterface $page */
$page = $this->grav['page'];

Expand Down Expand Up @@ -838,9 +831,8 @@ public function addFormDefinition(PageInterface $page, string $name, array $form

if (!isset($this->forms[$route][$name])) {
$form['_page_routable'] = !$page->isModule();

$this->forms[$route][$name] = $form;
$this->recache_forms = true;
$this->saveCachedForms();
}
}

Expand All @@ -863,7 +855,7 @@ public function addForm(?string $route, ?FormInterface $form): void
$form['_page_routable'] = true;

$this->forms[$route][$name] = $form;
$this->recache_forms = true;
$this->saveCachedForms();
}
}

Expand Down Expand Up @@ -1267,13 +1259,6 @@ protected function loadCachedForms(): void
*/
protected function saveCachedForms(): void
{
// Save the current state of the forms to cache
if (!$this->recache_forms) {
return;
}

$this->recache_forms = false;

/** @var Cache $cache */
$cache = $this->grav['cache'];

Expand Down

0 comments on commit 11aa715

Please sign in to comment.