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

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

jimport('joomla.html.html');
jimport('joomla.form.formfield');

class JFormFieldFwAddonCategoryParams extends JFormField {
	var	$type = 'fwaddoncategoryparams';

	function getInput() {
		if (!defined('FWFM_COMPONENT_SITE')) {
			define('FWFM_COMPONENT_SITE', JPATH_SITE.'/components/com_fwfoodmenu');
		}
		require_once(FWFM_COMPONENT_SITE.'/helpers/helper.php');

		fwFoodMenuHelper::loadAdminStyles();

		if (!defined('FWFM_COMPONENT_ADMINISTRATOR')) {
			define('FWFM_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR.'/components/com_fwfoodmenu');
		}
		require_once(FWFM_COMPONENT_ADMINISTRATOR.'/helpers/fwview.php');

		if (!is_array($this->value)) {
			$this->value = array();
		}

		ob_start();

		$buff = JFactory::getApplication()->triggerEvent('onGetCategoryMenuParams', array('com_fwfoodmenu', $this->name, $this->value));

		if ($buff) {
			echo implode('', $buff);
		} else {
			/* hide this row */
		}
		return ob_get_clean();
	}
}
