<?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' );

class MenuViewItem extends JViewLegacy {
	function display($tmpl=null) {
		$model = $this->getModel();
        $this->direct_link = false;

        $this->app = JFactory::getApplication();
        $this->row = $model->loadItem();
        $this->category = $model->loadCategory($this->row->category_id);
		if ($this->category->id) {
			$this->params = new JFParams($this->category->params, fwFoodMenuHelper::getParentCategories($this->category->parent));
			$this->params->set('category_id', array($this->category->id));
		} else {
			$this->params = new JFParams(new JRegistry);
		}
        $this->app->triggerEvent('onBeforeItemDisplay', array('com_fwfoodmenu', $this));
        parent::display($tmpl);
    }
}
