Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » version 2.3.0 rc1 - VirtualPage Status CMS error

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

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

Page: 1
Go to End
Author Topic: 907 Views
  • martimiz
    Forum Moderator
    1078 Posts

    version 2.3.0 rc1 - VirtualPage Status CMS error Link to this post

    In the CMS, when clicking on a page that has a VirtualPage pointing to it, I get the following (popup) error:

    ERROR [Notice]: Trying to get property of non-object
    IN POST /admin/getitem?ID=11&ajax=1
    Line 1117 in /undisclosedRoot/sapphire/core/model/SiteTree.php

    1108:      // Status / message
    1109:      // Create a status message for multiple parents
    1110:      if($this->ID && is_numeric($this->ID)) {
    1111:         $linkedPages = DataObject::get("VirtualPage", "CopyContentFromID = $this->ID");
    1112:      }
    1114:      if(isset($linkedPages)) {
    1115:         foreach($linkedPages as $linkedPage) {
    1116:            $parentPage = $linkedPage->Parent;
    * 1117:            $parentPageTitle = $parentPage->Title;
    1119:            if($parentPage->ID) {
    1120:               $parentPageLinks[] = "<a class=\"cmsEditlink\"
    1121:            } else {
    1122:               $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/$linkedPage->ID\">" .
    1123:                  _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') .

    line 375 of CMSMain.php

    line 740 of LeftAndMain.php

    line 245 of LeftAndMain.php

    line 164 of Controller.php

    line 107 of RequestHandler.php

    line 124 of Controller.php

    line 246 of Director.php

    line 106 of Director.php

    line 88 of main.php


    This will not happen when Page and its VirtualPage share the same parent, but in real life this will probably never be the case

    Possible solution:
    It seems that in line 1117 $parentPage->Title is not an object because in line 1116 the $linkedPage->Parent property does not exist. $linkedPage has access to a Parent() method however, that will return a proper parentobject. Possible replacement in SiteTree.php line 1116:

    $parentPage = $linkedPage->Parent;

    becomes (seems to be working):

    $parentPage = $linkedPage->Parent();

    Addition: status message
    As far as I understand this code is meant to extend the status message, to tell the user that a page has VirtualPages pointing to it, and where they might be found. This statusmessage, that also holds information about the published state of a page, is never shown. This is not a bug, the code is commented, but gives an error when uncommented:

    line 1273:
    //new NamedLabelField("Status", $message, "pageStatusMessage", true)

    I wanted to see what the message was all about so to show it in the reports section of the page I did the following. It works and didn't result in any errors as yet, but just as a temporary thing:

    line 1253:

    $tabReports = new TabSet('Reports',
       $tabBacklinks =new Tab('Backlinks',
          new LiteralField("Backlinks", $backlinks)


    $tabReports = new TabSet('Reports',
       $tabBacklinks =new Tab('Backlinks',
          new LiteralField("Backlinks", $backlinks),
          new LiteralField("Status", $message)

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.