Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Can't add pages after installing module subsites

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 1858 Views
  • dacar
    Avatar
    Community Member
    168 Posts

    Re: Can't add pages after installing module subsites Link to this post

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

    1858 Views
Page: 1 2
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.