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.

Customising the CMS

Revove Pages from CMS Sitetree


Reply

4 Posts   1028 Views

Avatar
DeklinKelly

14 August 2010 at 6:39am Community Member, 197 Posts

I want to remove all pages with a page class of "Video" from the CMS sitetree.

Attached Files
Avatar
swaiba

18 August 2010 at 3:23am Forum Moderator, 1796 Posts

I've looked into this, but haven't got there yet... this is from my notes... (you'll need to replace 'Logger' with your own method of debugging... a solution would be much appreciated by me too as I gave up!

class Hierarchy {

   ...

   function getChildrenAsUL {
      Logger::log($this);

      if (isset($this->ClassName))
      {
         Logger::log($this->ClassName);

         $do = new DataObject();
         $do->setCalssName($this->ClassName);
         $strName = get_parent_class($do);

         if ($strName == 'YOURPAGECLASS')
            return '';
      }

      ...

      }

      ...

}

Avatar
frankmullenger

20 October 2010 at 4:27pm Forum Moderator, 51 Posts

You can use the static $hide_ancestor var in class SiteTree but can only hide an ancestor I imagine, rather than any class.

Avatar
swaiba

20 October 2010 at 11:49pm Forum Moderator, 1796 Posts

With this I ended up making my pages non-existent in the sitetree, rather than hiding them...