Custom Attribute to filter in Autonav Template
Permalink
Hello everybody
I'm looking for an opportunity in the Autonav View filter on attributes in c5 5.7. In my case I want some navitems only in a meta navigation to spend and not in the main navigation. Can someone help me or give a tip?
Thanks
Marcus
I'm looking for an opportunity in the Autonav View filter on attributes in c5 5.7. In my case I want some navitems only in a meta navigation to spend and not in the main navigation. Can someone help me or give a tip?
Thanks
Marcus
Hi MrK
Ok, in concrete5 5.6 i set a custom page attribute (checkbox) with value 'only_metanavigation'. In autnav view i do this:
I'm using $_c->getCollectionAttributeValue('only_metanavigation) to get the value in concrete5 5.6 but whats the best practice to do this in concrete5 5.7?
I hope now you can understand my question?
Greets
Marcus
Ok, in concrete5 5.6 i set a custom page attribute (checkbox) with value 'only_metanavigation'. In autnav view i do this:
$aBlocks = $controller->generateNav(); $c = Page::getCurrentPage(); echo("<ul id=\"topnav\">"); $nh = Loader::helper('navigation'); $isFirst = true; foreach($aBlocks as $ni) { $_c = $ni->getCollectionObject(); if ($_c->getCollectionAttributeValue('only_metanavigation')) {
I'm using $_c->getCollectionAttributeValue('only_metanavigation) to get the value in concrete5 5.6 but whats the best practice to do this in concrete5 5.7?
I hope now you can understand my question?
Greets
Marcus
@marcusm
I believe I understand what you are looking to do.
I have attached a custom template for the Auto-Nav block.
application\blocks\autonav\templates\meta_navigation\view.php
These are the main changes:
As you loop through the $navItems array, you will get the individual nav item's collection object. You then call the getCollectionAttributeValue() method on the collection object to get the value of the "only_metanavigation" attribute.
I believe I understand what you are looking to do.
I have attached a custom template for the Auto-Nav block.
application\blocks\autonav\templates\meta_navigation\view.php
These are the main changes:
As you loop through the $navItems array, you will get the individual nav item's collection object. You then call the getCollectionAttributeValue() method on the collection object to get the value of the "only_metanavigation" attribute.
MrKDilkington that's it!
Many thanks
Many thanks
I am afraid I don't understand the question.
Please provide more details for what you are trying to accomplish.