Last active
April 27, 2021 18:21
-
-
Save erop/e37bee341deeb0d894535e78ac7da4d4 to your computer and use it in GitHub Desktop.
DocumentField annotation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Annotation; | |
use Doctrine\Common\Annotations\Annotation; | |
use Doctrine\Common\Annotations\Annotation\Target; | |
/** | |
* @Annotation | |
* @Target("PROPERTY") | |
*/ | |
class DocumentField | |
{ | |
/** | |
* Set <label> for the form field | |
* @Annotation\Required() | |
*/ | |
public string $label; | |
/** | |
* Choose the correct type for HTML input | |
* @Annotation\Required() | |
* @Annotation\Enum({"text", "textarea", "date", "select", "datetime-local", "email", "tel"}) | |
*/ | |
public string $htmlInputType = "text"; | |
/** | |
* Add default value if needed | |
*/ | |
public string $defaultValue; | |
/** | |
* Here you can set a mask for future validation tasks | |
*/ | |
public string $mask; | |
/** | |
* Use this element to inform frontend should the field be required or not | |
*/ | |
public bool $required = true; | |
/** | |
* If you need a <select> element in a form use this property | |
*/ | |
public array $values; | |
/** | |
* Setting to true will let you create a <select multiple> input | |
*/ | |
public bool $multiple = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment