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

feat(shortocodes): use entries instead of content

This commit is contained in:
Awilum
2021-07-26 22:03:27 +03:00
parent 1870111fba
commit 8a584a876f

View File

@@ -11,9 +11,9 @@ namespace Flextype\Support\Parsers\Shortcodes;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
// Shortcode: [content_fetch id="entry-id" field="field-name" default="default-value"]
// Shortcode: [entries_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'));
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'));
});
}