New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pages:next tag in a localised page throws "Call to a member function children() on null" #2184

Closed
MacTwister opened this Issue Sep 28, 2018 · 0 comments

Comments

Projects
None yet
3 participants
@MacTwister

MacTwister commented Sep 28, 2018

Describe the bug
I have lots of pages a children under a page. When viewing one of the children, I also show prev/next buttons to other children, that works. But when I am in a localised version of that child page (ie. /de/product/child-language-specific-slug) I get an error that children is null. The same logic works for collections.

To Reproduce
Steps to reproduce the behavior:

  1. Create lots of sub pages
  2. Make localised version of those sub pages with different slugs
  3. View one of the sub pages
  4. The below code will not work on the localised version of the page (ie. with the /de/ url prefix)
{{ pages:previous as="prev" limit="1" }}
    <div class="button-prev col-xs-6">
      {{ if no_results }}
        <img src="{{ theme:img src='arrow_big_grey_prev.svg' }}" alt="{{ title }}" />
      {{ /if }}

      {{ prev }}
        <a href="{{ url }}">
          <img src="{{ theme:img src='arrow_big_prev.svg' }}" alt="{{ title }}" />
        </a>
      {{ /prev }}
    </div>
{{ /pages:previous }}

Expected behavior
I get prev/next links with the right locale

Environment details:

  • Statamic Version: 2.10.5
  • Upgrade from around 2.9
  • OS: macOS 10.13.6
  • Browser: safari
  • Web Server: Valet
  • PHP Version: 7.2
  • Addons installed: spok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment