<?php
$str = '';
$top = null;
// si sous menu désactivé
if(isset($this->displaySubMenu) && $this->displaySubMenu == false) return null;

if( isset($this->structure)){

	$struct = $this->structure;
		
	if($struct->label == 'content_root') {
		$subMenuNode = 'content_root';
	}else{
		// get to top menu
		$top = $struct->getTop();
		$subMenuNode = $top->label;
	} 
}

if( !empty($subMenuNode) ){
	$subMenu = array( 'property' => 'ref', 'value' => $subMenuNode );
	$subMenuOpt = array(
		'maxDepth' => 3, 
		'minDepth' => 0, 
		'ulClass' => 'nav',
		'onlyActiveBranch' => false, 
		'renderParents' => true, 
		'renderInvisible'=>false , 
		'escape' => false );
			
			
	if($top){
		$str .= '<nav class="secondary hidden-phone">';
		$str .= '<header><h2><a href="' . $top->getUrl() . '" class="title">'. $top->title . '</a></h2></header>';
		
	}		
	$str .= $this->menus( $subMenu, $subMenuOpt );

	 
	if($top){
		$str .= '</nav>';
	}
}

if(!empty($str)) echo $str ;
