Jump to:

5453 Posts in 1674 Topics by 1198 members

Customising the CMS

SilverStripe Forums » Customising the CMS » VirtualPage doesn't pick up custom fields

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

Page: 1
Go to End
Author Topic: 1052 Views
  • NickJacobs
    Avatar
    Community Member
    144 Posts

    VirtualPage doesn't pick up custom fields Link to this post

    I have a few double-up pages round the site I am working on so thought I had found the answer with the VirtualPage type (keeps the nav & breadcrumb etc intact)....but, I have quite a few different page types in the site and VirtualPage only picks up content and not the custom fields...

    Has anyone found a workaround for this. ??

    the proper page
    the virtual page (video content not picked up)

  • Helican
    Avatar
    Community Member
    1 Post

    Re: VirtualPage doesn't pick up custom fields Link to this post

    Here's what I'm doing. Seems to work for me.

    I have an Event page type, which can have any number of Artist pages as children, but I'm using virtual pages that point to Artist pages rather than actual Artist pages.

    So I put this function into EventPage_Controller.

    function artistPages() {
       $children = $this->Children();
       $return = new DataObjectSet();
       foreach ($children as $key)
       {
          $virtualPage = DataObject::get_by_id('VirtualPage', $key->ID);
          $artistPage = DataObject::get_by_id('ArtistPage', $virtualPage->CopyContentFromID);
          $return->push($artistPage);
       }
       return $return;
    }

    and then I put this into EventPage.ss

    <% control artistPages %>
    $ArtistName
    $ArtistDescription
    <% end_control %>

    1052 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.