Jump to:

3461 Posts in 1065 Topics by 740 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Silverstripe: Show or hide pages on condition

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 293 Views
  • Neelam
    Community Member
    15 Posts

    Silverstripe: Show or hide pages on condition Link to this post

    I am using silverstripe 3.0.0

    Need to hide/show certain pages in the CMS tree view as well as list view and also all other places where they are displayed in the back end...like TreeDropDownFields etc.
    This is based on a field value

    I have tried by defining canView in Page.php but it doesn't work the way i want..

    What worked for me was the following (added this code to an extension of SiteTree)

    function augmentSQL(SQLQuery &$query) {
    if(my condition here)
    $query->addWhere(where condition here);

    Need to know if there is any better way than this....Any side effects of the above piece of code? Also need to add a filter for the Groups in the same way....

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.