<?php
	/**
	 * @version     1.0.1
	 * @package     Joomla 5
	 * @subpackage  Formea Core ModalSlide
	 * @author      Feseur Sdn Bhd
	 * @copyright   Copyright (C) 2010 - 2024 Feseur Sdn Bhd
	 * @license     GNU/GPL, see LICENSE.php
	 */

	namespace Joomla\Component\Formea\Plugins\Core\ModalSlide\Field;

	use Joomla\CMS\Factory;
	use Joomla\CMS\Form\FormField;
	use Joomla\CMS\Form\FormHelper;
	use Joomla\CMS\WebAsset\WebAssetManager;
	class FormeaCoreModalSlideField extends FormField
	{
		/**
		 * The name field type.
		 *
		 * @var    string
		 */
		protected $type = 'FormeaCoreModalSlide';

		public function __construct($form = null)
		{
			parent::__construct($form);
			$app = Factory::getApplication();
			/** @var WebAssetManager $wa */
			$wa = $app->getDocument()->getWebAssetManager();
			$registry = $wa->getRegistry();
			$registry->addRegistryFile('/components/com_formea/plugins/core/ModalSlide/joomla.asset.json');
			$wa->useScript('com_formea.core.ModalSlide.admin-field');
		}

		protected function getLabel()
		{
			return '';
		}

		/**
		 * Method to get the field input markup for the file field.
		 * Field attributes allow specification of a maximum file size and a string
		 * of accepted file extensions.
		 *
		 * @return  string  The field input markup.
		 *
		 * @note    The field does not include an upload mechanism.
		 * @see     \Joomla\CMS\Form\Field\MediaField
		 * @since   1.7.0
		 */
		protected function getInput()
		{

			return '<hr/><formea-modal-slide></formea-modal-slide>';
		}

		/**
		 * Method to get a control group with label and input.
		 *
		 * @param   array  $options  Options to be passed into the rendering of the field
		 *
		 * @return  string  A string containing the html for the control group
		 *
		 * @since   3.2
		 */
		public function renderField($options = [])
		{
			return $this->getInput();
		}

	}
