How do I change the default Silverstripe theme 'Simple' so that when a submenu (on the sidebar) is clicked the sidebar menu is replaced by a breadcrumb via $Breadcrumbs. Example when Menu1 is clicked, the sidebar is shown
Menu1 Menu2 Menu3
Menu1 (not clickable, just a title)
SubMenu1
SubMenu2
but when either SubMenu1 or SubMenu2 is clicked entire sidebar dissapears and a $Breadcrumbs is shown.
Menu1 Menu2 Menu3
Menu1-->SubMenu1
$Content
Therefore when Menu1 on Breadcrumb is clicked, it goes back to Menu1.
First of all, why do you want to achieve this? I can't see a real benefit out here, but if you really need this, so this could be possible an answer:
1) If you are on the $Menu(1)
level show only $MenuTitle.XML
(or just $Title
, they're almost the same)in the sidebar
2) Else If you are on the $Menu(2)
or deeper than (2)
level show breadcrumbs
You could achieve this by checking on which level you are at the moment and display what you need:
<% if $Menu(1) %>
<!-- Here you print only titles-->
<% loop $Menu(1) %>
<a href="$Link">$MenuTitle.XML</a>
<% end_loop %>
<% else %>
<!-- Here you print out the BreadCrumbs, only if you are deeper than 1st level menu -->
<% include $BreadCrumbs %>
<% end_if %>
Here you check if you are on first level then display only titles with links, then if you are on the subpage display the BreadCrumbs