Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » hide_ancestor not working

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1559 Views
  • freeyland
    Avatar
    Community Member
    22 Posts

    hide_ancestor not working Link to this post

    I am trying to hide the ancestor class, but in the sitetree the pagetype 'Productgroup' is still available. Anyone has an idea why?

    class ProductGroupRandom extends ProductGroup {
       static $hide_ancestor = ProductGroup;
       
       
    }

    class ProductGroupRandom_Controller extends ProductGroup_Controller {
       public function Testfuntion($showAll = false) {
             $hallo="test";
             return $hallo;
          
       }   
          
    }

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: hide_ancestor not working Link to this post

    There's some more reference for this that can be found here:

    http://www.silverstripe.com/general-discussion/flat/2741

    It's possible that the fix was implemented into the development branch of SilverStripe, so perhaps the code change on that forum post will help.

    Cheers,
    Sean

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: hide_ancestor not working Link to this post

    You might also want to try putting $hide_ancestor = 'ProductGroup'; rather than just ProductGroup.

    The wiki page for it was found here: http://doc.silverstripe.com/doku.php?id=hide-ancestor

    Cheers,
    Sean

  • freeyland
    Avatar
    Community Member
    22 Posts

    Re: hide_ancestor not working Link to this post

    I checked SiteTree.php and the code is the same as in the posted forum thread. I also added the quotes but the page 'Productgroup' is still available.

    $instance = singleton($class);
    if((($instance instanceof HiddenClass) || !$instance->canCreate()) && ($class != $this->class)) continue;

    $addAction = $instance->uninherited('add_action', true);
    if(!$addAction) $addAction = "a $class";

    1559 Views
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.