for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Faulancer\Form\Type\Base;
use Faulancer\Form\Type\AbstractType;
/**
* Class Hidden
*
* @package Faulancer\Form\Type\Base
* @author Florian Knapp <[email protected]>
*/
class Hidden extends AbstractType
{
/** @var string */
protected $inputType = 'input';
protected $element = '';
* @return self
public function create()
parent::create();
$output = '<' . $this->inputType;
foreach ($this->definition['attributes'] as $attr => $value) {
if (!empty($this->getValue()) && $attr === 'value') {
continue;
}
if ($attr === 'name' && $value === 'csrf' && $this->getValue()) {
$output .= ' ' . $attr . '="' . $value . '" ';
if (!empty($this->getValue())) {
$output .= ' value="' . $this->getValue() . '"';
$output .= '/>';
$this->element = $output;
return $this;