1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-06 05:07:41 +02:00

feat(directive): add ability to disabled expressions using !expressions

This commit is contained in:
Awilum
2022-09-13 09:40:38 +03:00
parent 60be00d82c
commit 369ba2f0cb

View File

@@ -16,6 +16,7 @@ declare(strict_types=1);
namespace Flextype\Entries\Directives;
use function Glowy\Strings\strings;
use function Flextype\emitter;
use function Flextype\entries;
use function Flextype\parsers;
@@ -24,6 +25,7 @@ use function Flextype\collection;
// Directive: [[ ]] [% %] [# #]
emitter()->addListener('onEntriesFetchSingleField', static function (): void {
if (! registry()->get('flextype.settings.entries.directives.expressions.enabled')) {
return;
}
@@ -34,6 +36,10 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
$field = entries()->registry()->get('methods.fetch.field');
if (is_string($field['value']) && strings($field['value'])->contains('!expressions')) {
return;
}
$vars = [];
// Convert entry fields to vars.