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.

All other Modules /

Discuss all other Modules here.

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

Can't add pages after installing module subsites


Go to End


9 Posts   4687 Views

Avatar
dacar

Community Member, 173 Posts

3 January 2013 at 9:56am

hmmm, after changing $subsite = $this->owner->Subsite(); to $subsite = Subsite::currentSubsite(); it is working now.

	function updateCMSFields(&$fields) {
		if($this->owner->MasterPageID) $fields->insertFirst(new HeaderField('This page\'s content is copied from a master page: ' . $this->owner->MasterPage()->Title, 2));
		
		// replace readonly link prefix
		//$subsite = $this->owner->Subsite();
		$subsite = Subsite::currentSubsite();
		if($subsite && $subsite->ID) {
			$baseUrl = 'http://' . $subsite->domain() . '/';
			$fields->removeByName('BaseUrlLabel');
			$fields->addFieldToTab(
				'Root.Content.Metadata',
				new LabelField('BaseUrlLabel',$baseUrl),
				'URLSegment'
			);
		}

Go to Top