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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

hide_ancestor not working


Go to End


4 Posts   2397 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:

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

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: http://doc.silverstripe.com/doku.php?id=hide-ancestor

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