Subsites: hide "Main Site" from subsite chooser in backend

So your client wants to manage multiple websites with one CMS installation and you've choosen Subsites module for that purpose, there is always that magical "Main Site" in your site chooser.

This "Main Site" is the subsite with the ID 0 (some kind of non-Subsite), and there doesn't seem to be a way to disable this using configuration. But we can modify the template showing the subsite select field in backend, which is located in subsites/templates/Includes/SubsiteList.ss:

<div class="cms-subsites" data-pjax-fragment="SubsiteList">
	<div class="field dropdown">
		<select id="SubsitesSelect">
			<% loop $ListSubsites %>
				<% if $ID %>
                    <option value="$ID" $CurrentState>$Title</option>
				<% end_if %>
			<% end_loop %>
		</select>
	</div>
</div>


Simply copy this to mysite/templates/Includes/SubsiteList.ss and subsite chooser in the left navigation should not show "Main Site" any more.

Rate this post

Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments