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

refactor(shortcodes): add additional check for entries_fetch shortcode - revert

This commit is contained in:
Awilum
2020-08-21 22:51:27 +03:00
parent d1418369c5
commit f1420eb485

View File

@@ -13,12 +13,6 @@ use Thunder\Shortcode\Shortcode\ShortcodeInterface;
if ($flextype->container('registry')->get('flextype.settings.shortcode.shortcodes.entries.enabled')) {
// Shortcode: [entries_fetch id="entry-id" field="field-name" default="default-value"]
$flextype->container('shortcode')->addHandler('entries_fetch', static function (ShortcodeInterface $s) use ($flextype) {
if ($s->getParameter('id') != null &&
$s->getParameter('field') != null &&
$s->getParameter('default') != null) {
return Arrays::get($flextype->container('entries')->fetch($s->getParameter('id')), $s->getParameter('field'), $s->getParameter('default'));
}
return '';
return Arrays::get($flextype->container('entries')->fetch($s->getParameter('id')), $s->getParameter('field'), $s->getParameter('default'));
});
}