<?php
/**
 * FW Food menu 5.1.1
 * @copyright (C) 2020 Fastw3b
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link http://www.fastw3b.net/ Official website
 **/

defined( '_JEXEC' ) or die( 'Restricted access' );

$view = $displayData['view'];
$row = $view->row;

$desc_pos = $view->params->get('category_descr_position', 'top');
$desc_display = $view->params->get('display_category_shortdescription', 1);

if (!empty($view->prev_subcategory_id)) {
?>
	</div>
<?php
	if (!empty($view->subcat_description) and $view->subcat_description_position == 'bottom') {
?>
	<div class="fwfm-subcategory-text">
		<?php echo $view->subcat_description; ?>
	</div>
<?php
	}
?>
</div>
<?php
}

$additional_classes = ' fwfm-menu-item-'.$row->id.' fwfm-subcategory-body-'.$view->params->get('category_descr_position', 'top');
$view->app->triggerEvent('onCollectCategoryStatus', array('com_fwfoodmenu', $view, $row, &$additional_classes));
$view->app->triggerEvent('onSetSubCategoryExtraClasses', array('com_fwfoodmenu', $view, $row));

?>
<a name="<?php echo $row->alias; ?>"></a>
<div class="fwfm-subcategory-item <?php echo $additional_classes; ?>" id="fwfm-category-<?php echo $row->id; ?>" data-cid="<?php echo $row->id; ?>" data-alias="<?php echo $row->alias; ?>">
<?php
if ($view->params->get('display_category_title', 1) or ($desc_display and $row->short_description)) {
?>
	<div class="fwfm-category-title-wrapper">
<?php
	$view->app->triggerEvent('onShowSubCategoryItemHeader', array('com_fwfoodmenu', $view, $row));
	if ($view->params->get('display_category_title', 1)) {
?>
		<div class="fwfm-category-title fwfm-level-<?php echo $row->level; ?>"><span><?php echo $row->name; ?></span></div>
<?php
	}
	if ($desc_display and $row->short_description) {
?>
		<div class="fwfm-category-short-text">
			<?php echo $row->short_description; ?>
		</div>
<?php
	}
?>
	</div>
<?php
}

$view->subcat_description = $row->description;
$view->subcat_description_position = $desc_pos;
if (!empty($row->description) and $desc_pos != 'bottom') {
?>
	<div class="fwfm-subcategory-text"><?php echo $row->description; ?></div>
<?php
}
$view->prev_subcategory_id = $row->id;
?>
	<div class="fwfm-subcategory-meals">
