fdb423d2c7
BUG-001: cache-on-save plugin clears page cache on onFormProcessed so new entries appear in the tracker feed immediately after submission. BUG-002: disabled Twig template cache (twig.cache: false) so theme file changes take effect without a manual cache flush. Also adds bugs-and-fixes.md, corrects TC-P test URLs (.entry suffix), fixes TC-P.1 expectation (inline login form, not a redirect), and creates the QA test entry for automated scenario verification. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
542 B
PHP
27 lines
542 B
PHP
<?php
|
|
namespace Grav\Plugin;
|
|
|
|
use Grav\Common\Plugin;
|
|
use RocketTheme\Toolbox\Event\Event;
|
|
|
|
class CacheOnSavePlugin extends Plugin
|
|
{
|
|
public static function getSubscribedEvents(): array
|
|
{
|
|
return [
|
|
'onFormProcessed' => ['onFormProcessed', 0],
|
|
];
|
|
}
|
|
|
|
public function onFormProcessed(Event $event): void
|
|
{
|
|
$form = $event['form'];
|
|
if (!$form) {
|
|
return;
|
|
}
|
|
if ($form->getName() === 'new-entry') {
|
|
$this->grav['cache']->clear();
|
|
}
|
|
}
|
|
}
|