25
loading...
This website collects cookies to deliver better user experience
$AdminURL
which we can use to create a link to the admin page. So how we could add a link to the admin page with the simple
theme (which is the default theme for Silverstripe) would look like this: .\themes\simple\templates\Includes\Navigation.ss
<nav class="primary">
<span class="nav-open-button">²</span>
<ul>
<% loop $Menu(1) %>
<li class="$LinkingMode"><a href="$Link" title="$Title.XML">$MenuTitle.XML</a></li>
<% end_loop %>
<li><a href="$AdminURL" title="Admin">Admin</a></li>
</ul>
</nav>
vendor\silverstripe\admin\templates\SilverStripe\Admin\Includes\LeftAndMain_MenuList.ss
. We can inject our own template by populating same "namespace". By doing this, SilverStripe will prioritize our template - be it just a partial template. Here is how we do that: LeftAndMain_MenuList.ss
.\app
folder: templates\SilverStripe\Admin\Includes\
templates\SilverStripe\Admin\Includes\
folder.app\templates
folder as we found in the vendor\silverstripe\admin\templates\
. This is all that it takes to inject our own template into the CMS interface. Currently though, we would not see any difference as we just did a copy and paste. So what we will do next is modify our template.<ul class="cms-menu__list">
<% loop $MainMenu %>
<li class="$LinkingMode $FirstLast <% if $LinkingMode == 'link' %><% else %>opened<% end_if %>" id="Menu-$Code" title="$Title.ATT">
<a href="$Link" $AttributesHTML>
<% if $IconClass %>
<span class="menu__icon $IconClass"></span>
<% else_if $HasCSSIcon %>
<span class="menu__icon icon icon-16 icon-{$Icon}"> </span>
<% else %>
<span class="menu__icon font-icon-circle-star"> </span>
<% end_if %>
<span class="text">$Title</span>
</a>
</li>
<% end_loop %>
<%-- Let's add a link to DEV here --%>
<li>
<a href="https://dev.to">
<span class="menu__icon font-icon-circle-star"> </span>
<span class="text">DEV</span>
</a>
</li>
</ul>