Cms: Variables Inside Tag Parameters don't work for limit param in a collection

Created on 30 Nov 2019  路  9Comments  路  Source: statamic/cms

For the following setup, I'm getting this error: Object of class Statamic\Fields\Value could not be converted to int

# home.md

latest_articles_number: '3'
<!-- home.antlers.html -->

{{ collection:blog as="posts" :limit="latest_articles_number" }}
<section class="section has-background-black">
    {{ posts }}
    <div class="column">
      {{ partial:blog/card }}
    </div>
    {{ /posts }}
</section>
{{ /collection:blog }}
augmentation bug duplicate

All 9 comments

@jimblue are you on the latest version? There was a change in how you update Statamic now.

@edalzell I've use migrator maybe a week ago.
Since I update my project almost everyday: composer update statamic/cms --with-dependencies
But I don't know how to check for the actual version number?

BTW here is the update log:

# > composer update statamic/cms --with-dependencies

Dependency "laravel/framework" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Dependency "laravel/framework" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: barryvdh/laravel-debugbar
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: intervention/httpauth
Discovered Package: intervention/image
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: statamic/cms
Discovered Package: wilderborn/partyline
Package manifest generated successfully.
> @php artisan statamic:install --ansi
Addon manifest generated successfully.
Copied Directory [/vendor/statamic/cms/resources/users] To [/resources/users]
Publishing complete.
Publishing complete.
Copied Directory [/vendor/statamic/cms/resources/dist] To [/public/vendor/statamic/cp]
Publishing complete.
Publishing complete.
Compiled views cleared!
Application cache cleared!

Thank you for providing the logs but i don鈥檛 think you鈥檝e done anything wrong. What kind of field is latest_articles_number in your blueprint?

Hey @jasonvarga, sure here is the interesting part of my blueprint:

latest_articles:
    display: 'Latest articles'
    fields:
      -
        handle: latest_articles_enabled
        field:
          type: toggle
          display: Enable
      -
        handle: latest_articles_heading
        field:
          type: text
          display: Heading
          localizable: true
          validate: required
          if:
            latest_articles_enabled: 'equals 1'
      -
        handle: latest_articles_number
        field:
          type: integer
          localizable: false
          display: 'Post(s) to display'
          validate: required
          if:
            latest_articles_enabled: 'equals 1'

Any update? I still have this issue in beta 14.

Issue is still open 馃憤

Because the issue has no tag I wasn't sure if it was consider as a bug or would be resolve...
But considering your answering time of 1min I was wrong haha! Thanks 馃槉

This is actually the same issue as #1028. Closing because we only need one :)

Was this page helpful?
0 / 5 - 0 ratings