Skip to content
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

(Feature Request) Template methods for disabling subsite filter #474

Open
davejtoews opened this issue Jan 17, 2022 · 1 comment
Open

(Feature Request) Template methods for disabling subsite filter #474

davejtoews opened this issue Jan 17, 2022 · 1 comment

Comments

@davejtoews
Copy link

I'm able to disable subsite filters in a template by doing the following.

    $Subsite.disable_subsite_filter
    <% loop $Items %>
        <div> ... </div>
    <% end_loop %>
    $Subsite.disable_subsite_filter(0)

But passing a zero gets evaluated as a falsy string "0" rather than a true boolean value. This works but it doesn't seem particularly clean. Might be better to just have two template global methods DisableSubsiteFilter() and EnableSubsiteFilter()?

Or alternately for the use case I'm encountering it might be handy to opt a particular object relationship out of Subsite filtering altogether. I'm having to disable subsite filtering both on the CMS fields and in the template.

@michalkleiner
Copy link
Contributor

You can create a class implementing TemplateGlobalProvider interface and add the methods there. Possibly the Subsite class itself can implement that interface and expose the mechanism for templates. Happy to look at a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants