core icon indicating copy to clipboard operation
core copied to clipboard

setcontent limit shortcut does not work

Open Spomsoree opened this issue 3 years ago • 2 comments

When fetching content the documentation suggest using a shortcut for the limit: https://docs.boltcms.io/5.0/templating/content-fetching#one-record-or-multiple-records

{% setcontent mypages = 'page' latest 5 %}

image

Id I use {% setcontent mypages = 'page' latest limit 5 %} it works as expected.

Details

Question Answer
Relevant Bolt Version 5.1.8-pl.2
Install type Composer install
PHP version 8.1
Web server Nginx

Reproduction

Just use the example provided in the documentation.

Expected result

Results should be the same with {% setcontent mypages = 'page' latest 5 %} or {% setcontent mypages = 'page' latest limit 5 %}

Spomsoree avatar Jun 03 '22 10:06 Spomsoree

Hm, that could be a mistake in the docs and that limit is always required (or rather that latest doesn't take a limit). There's an example higher up with:

{% setcontent latestpages = 'pages' latest limit 5 %}

Update: It looks like LatestDirectiveHandler doesn't take an extra param.

xiaohutai avatar Jun 10 '22 09:06 xiaohutai