mirror of
https://github.com/flextype/flextype.git
synced 2025-08-07 05:36:54 +02:00
feat(directives): add ability to set enabled_globaly
setting
This commit is contained in:
@@ -28,6 +28,8 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
|
||||
if (is_string($field['value'])) {
|
||||
if (strings($field['value'])->contains('@markdown')) {
|
||||
$field['value'] = strings(parsers()->markdown()->parse($field['value']))->replace('@markdown', '')->trim()->toString();
|
||||
} elseif (registry()->get('flextype.settings.entries.directives.markdown.enabled_globally')) {
|
||||
$field['value'] = parsers()->markdown()->parse($field['value']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,10 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
|
||||
ob_start();
|
||||
eval(strings($field['value'])->replace('@php', '')->trim()->toString());
|
||||
$field['value'] = ob_get_clean();
|
||||
} elseif (registry()->get('flextype.settings.entries.directives.php.enabled_globally')) {
|
||||
ob_start();
|
||||
eval(strings($field['value'])->replace('@php', '')->trim()->toString());
|
||||
$field['value'] = ob_get_clean();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,11 +24,11 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
|
||||
}
|
||||
|
||||
$field = entries()->registry()->get('methods.fetch.field');
|
||||
|
||||
|
||||
if (is_string($field['value'])) {
|
||||
if (strings($field['value'])->contains('@shortcodes')) {
|
||||
$field['value'] = strings(parsers()->shortcodes()->parse($field['value']))->replace('@shortcodes', '')->trim()->toString();
|
||||
} elseif (registry()->get('flextype.settings.entries.parsers.shortcodes.enabled') !== false) {
|
||||
} elseif (registry()->get('flextype.settings.entries.directives.shortcodes.enabled_globally')) {
|
||||
$field['value'] = parsers()->shortcodes()->parse($field['value']);
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,8 @@ emitter()->addListener('onEntriesFetchSingleField', static function (): void {
|
||||
if (is_string($field['value'])) {
|
||||
if (strings($field['value'])->contains('@textile')) {
|
||||
$field['value'] = strings(parsers()->textile()->parse($field['value']))->replace('@textile', '')->trim()->toString();
|
||||
} elseif (registry()->get('flextype.settings.entries.directives.textile.enabled_globally')) {
|
||||
$field['value'] = parsers()->textile()->parse($field['value']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -74,14 +74,12 @@ errors:
|
||||
# Entries
|
||||
entries:
|
||||
directory: '/entries'
|
||||
parsers:
|
||||
shortcodes:
|
||||
enabled: true
|
||||
vars:
|
||||
debug: false
|
||||
directives:
|
||||
shortcodes:
|
||||
enabled: true
|
||||
enabled_globally: true
|
||||
path: "/src/flextype/core/Entries/Directives/ShortcodesDirective.php"
|
||||
constants:
|
||||
enabled: true
|
||||
@@ -97,12 +95,15 @@ entries:
|
||||
path: "/src/flextype/core/Entries/Directives/CalcDirective.php"
|
||||
markdown:
|
||||
enabled: true
|
||||
enabled_globally: false
|
||||
path: "/src/flextype/core/Entries/Directives/MarkdownDirective.php"
|
||||
textile:
|
||||
enabled: true
|
||||
enabled_globally: false
|
||||
path: "/src/flextype/core/Entries/Directives/TextileDirective.php"
|
||||
php:
|
||||
enabled: true
|
||||
enabled_globally: false
|
||||
path: "/src/flextype/core/Entries/Directives/PhpDirective.php"
|
||||
types:
|
||||
enabled: true
|
||||
|
4
tests/fixtures/settings/settings.yaml
vendored
4
tests/fixtures/settings/settings.yaml
vendored
@@ -70,14 +70,12 @@ errors:
|
||||
# Entries
|
||||
entries:
|
||||
directory: '/entries'
|
||||
parsers:
|
||||
shortcodes:
|
||||
enabled: true
|
||||
vars:
|
||||
debug: false
|
||||
directives:
|
||||
shortcodes:
|
||||
enabled: true
|
||||
enabled_globally: true
|
||||
path: "/src/flextype/core/Entries/Directives/ShortcodesDirective.php"
|
||||
constants:
|
||||
enabled: true
|
||||
|
Reference in New Issue
Block a user