<?php
  /**
   * @package     Joomla\Component\Formea\Plugins\Core\Conditionals\Field
   * @subpackage
   *
   * @copyright   A copyright
   * @license     A "Slug" license name e.g. GPL2
   */

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

  use Joomla\CMS\Form\FormField;
  use Joomla\CMS\Form\FormHelper;

  class FormeaCoreConditionalField extends FormField
  {
    /**
     * The name field type.
     *
     * @var    string
     */
    protected $type = 'FormeaCoreConditional';



    public function __construct($form = null)
    {
      parent::__construct($form);

    }

    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()
    {
      $formId = (int) $this->getAttribute('data-formid');

      return '<formea-core-conditionals name="'.$this->name.'" form-id="' . $formId . '"></formea-core-conditionals>';
    }

    /**
     * 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();
    }

  }
