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

feat(entries): update settings #552

This commit is contained in:
Awilum
2021-07-16 21:31:05 +03:00
parent 6bfb8b2e59
commit 126068dc29

View File

@@ -11,9 +11,9 @@ namespace Flextype\Support\Parsers\Shortcodes;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
// Shortcode: [entries_fetch id="entry-id" field="field-name" default="default-value"]
if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.entries.enabled')) {
flextype('parsers')->shortcode()->addHandler('entries_fetch', static function (ShortcodeInterface $s) {
return arrays(flextype('entries')->fetch($s->getParameter('id')))->get($s->getParameter('field'), $s->getParameter('default'));
// Shortcode: [content_fetch id="entry-id" field="field-name" default="default-value"]
if (flextype('registry')->get('flextype.settings.parsers.shortcode.shortcodes.content.enabled')) {
flextype('parsers')->shortcode()->addHandler('content_fetch', static function (ShortcodeInterface $s) {
return arrays(flextype('content')->fetch($s->getParameter('id')))->get($s->getParameter('field'), $s->getParameter('default'));
});
}