Hide view or layout in the Joomla menu manager
If you are building your own component, and you have layouts or entire views you wish to hide from the backend menu manager, you can do so with very little effort and some bits of XML.
Hide a view
Within your component, for instance in the bar view in the foo component, you have a metadata.xml-file:
/components/com_foo/views/bar/metadata.xml
The first three lines of this component might look like this:
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="Bar">
<message><![CDATA[BARDESC]]></message>
</view>
</metadata>
To hide this view from the menu manager, all you have to do is add the parameter hidden=true to the view element, like this:
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="Bar" hidden="true">
<message><![CDATA[BARDESC]]></message>
</view>
</metadata>
You can also hide a view by using an underscore in it’s name.
Hide a layout
Hiding a layout is done in a similar manner, but here you have to edit the layout’s XML-file. Let’s say you want to hide the default layout in the same view as in the example above. You then have to edit this file:
/components/com_foo/views/bar/tmpl/default.xml
In the same manner as above, you add hidden=”true”, but this time you add it to the layout element in the XML-file.
Comments for this entry
Nice trick :)
Thanks – simple and useful and didn't have to research it my self!
;-)
Thank you this nice post.
Leave your comment
Please be polite. You can use these HTML tags:
STRONG,A,BLOCKQUOTE,CODE