mirror of
https://github.com/flextype/flextype.git
synced 2025-08-08 14:16:46 +02:00
feat(media-folder): use Atomastic Arrays for entries_fetch shortcode. #478
This commit is contained in:
@@ -7,12 +7,11 @@ declare(strict_types=1);
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
use Flextype\Component\Arrays\Arrays;
|
||||
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
|
||||
|
||||
// Shortcode: [entries_fetch id="entry-id" field="field-name" default="default-value"]
|
||||
if (flextype('registry')->get('flextype.settings.shortcode.shortcodes.entries.enabled')) {
|
||||
flextype('shortcode')->addHandler('entries_fetch', static function (ShortcodeInterface $s) {
|
||||
return Arrays::get(flextype('entries')->fetch($s->getParameter('id')), $s->getParameter('field'), $s->getParameter('default'));
|
||||
return arrays(flextype('entries')->fetch($s->getParameter('id')))->get($s->getParameter('field'), $s->getParameter('default'));
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user