Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

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

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

hide_ancestor not working


Reply


4 Posts   1618 Views

Avatar
freeyland

Community Member, 22 Posts

3 August 2007 at 9:54pm

Edited: 03/08/2007 11:09pm

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;
      
   }   
      
}

Avatar
Sean

Forum Moderator, 922 Posts

4 August 2007 at 4:49pm

Edited: 04/08/2007 4:53pm

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

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

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

Avatar
Sean

Forum Moderator, 922 Posts

4 August 2007 at 4:51pm

Edited: 04/08/2007 4:53pm

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

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

Cheers,
Sean

Avatar
freeyland

Community Member, 22 Posts

6 August 2007 at 10:06pm

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";