<?php
  /**
   * @package     Formea.Plugin
   * @subpackage  element
   *
   * @copyright   Copyright (C) 2010-2022 Feseur Sdn Bhd. All rights reserved.
   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   */
// no direct access
  defined('_JEXEC') or die();

  use Joomla\Component\Formea\Site\Libraries\FormeaEltype;

  class FormeaHiddenInput extends FormeaEltype
  {
    public function __construct($config = [])
    {
      parent::__construct($config);
    }

    public function getLabel($label = 'label', $class = [], $preview = false)
    {
      return '';
    }

    public function getInput($class = [], $inputAttributes = [], $langTagUnderscore = '', $preview = false, $labelSetting = null)
    {
      $value = '';
      if (isset($inputAttributes['value']))
      {
        $value = $inputAttributes['value'];
      }

      if ($preview)
      {
        $input = '<span class="text-muted">&lt;hidden\&gt;</span>';
        $input .= ' <span>' . $this->element_title . ' : ' . $value . '</span>';
      }
      else
      {

        $input = '<input type="hidden" ';
        $input .= 'value="' . $value . '"';
        $input .= 'name="' . $this->formatElementName() . '"';
        $input .= 'id="' . $this->formatElementId() . '"';
        $input .= ' />';
      }


      return $input;
    }
  }
