Back

Custom Field - Hiding a Tab based on host

Description

This code is an example of how you can get the host id that a content editor is on, and based on that host ID it will show or hide a tab in the content editing screen.

The example assumes you have a tab field divider with a velocity variable name: otherData

Code

#set($sessionHost = $request.getSession().getAttribute("CMS_SELECTED_HOST_ID"))


#if($sessionHost != "8ae39afa-19bc-4f20-ad8c-95bd73d76109")
	<script>
		dojo.addOnLoad(function(){
			dijit.byId('mainTabContainer').removeChild(dijit.byId('otherData'));
		})
	</script>
#end