1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-07 13:46:42 +02:00

fix(directives): fix issue with 2x caching of markdown, shortcodes and textile

This commit is contained in:
Awilum
2022-06-09 20:28:38 +03:00
parent daaa3ee1ef
commit ed6f420929
3 changed files with 27 additions and 0 deletions

View File

@@ -23,6 +23,12 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
return;
}
// Save markdown cache state to restore it later
$markdownCacheState = registry()->get('flextype.settings.parsers.markdown.cache');
// Set markdown cache to false
registry()->set('flextype.settings.parsers.markdown.cache', false);
$field = entries()->registry()->get('methods.fetch.field');
if (is_string($field['value'])) {
@@ -35,4 +41,7 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
entries()->registry()->set('methods.fetch.field.key', $field['key']);
entries()->registry()->set('methods.fetch.field.value', $field['value']);
// Restore markdown cache state
registry()->set('flextype.settings.parsers.markdown.cache', $markdownCacheState);
});

View File

@@ -23,6 +23,12 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
return;
}
// Save shortcodes cache state to restore it later
$shortcodesCacheState = registry()->get('flextype.settings.parsers.shortcodes.cache');
// Set shortcodes cache to false
registry()->set('flextype.settings.parsers.shortcodes.cache', false);
$field = entries()->registry()->get('methods.fetch.field');
if (is_string($field['value'])) {
@@ -35,4 +41,7 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
entries()->registry()->set('methods.fetch.field.key', $field['key']);
entries()->registry()->set('methods.fetch.field.value', $field['value']);
// Restore shortcodes cache state
registry()->set('flextype.settings.parsers.shortcodes.cache', $shortcodesCacheState);
});

View File

@@ -23,6 +23,12 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
return;
}
// Save textile cache state to restore it later
$textileCacheState = registry()->get('flextype.settings.parsers.textile.cache');
// Set textile cache to false
registry()->set('flextype.settings.parsers.textile.cache', false);
$field = entries()->registry()->get('methods.fetch.field');
if (is_string($field['value'])) {
@@ -35,4 +41,7 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
entries()->registry()->set('methods.fetch.field.key', $field['key']);
entries()->registry()->set('methods.fetch.field.value', $field['value']);
// Restore textile cache state
registry()->set('flextype.settings.parsers.textile.cache', $textileCacheState);
});