Last active
September 8, 2021 12:08
-
-
Save estefanionsantos/a1515d2fb99db5ff87daab937e18493c to your computer and use it in GitHub Desktop.
fieldset form rubricate
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 | |
use Rubricate\Form\FieldsetForm; | |
use Rubricate\Form\LabelForm; | |
use Rubricate\Form\CheckboxForm; | |
$elem = new FieldsetForm('Category:'); | |
for ($i = 1; $i <= 3; $i++) { | |
$checkbox = new CheckboxForm('checkbox[]', $i); | |
$option = $checkbox->getElement() . ' Option ' . $i; | |
$label = new LabelForm($option); | |
$elem->addChild($label); | |
} | |
echo $elem->getElement(); | |
/* | |
<fieldset> | |
<legend>Category:</legend> | |
<label> | |
<input type="checkbox" name="checkbox[]" value="1" /> Option 1 | |
</label> | |
<label> | |
<input type="checkbox" name="checkbox[]" value="2" /> Option 2 | |
</label> | |
<label> | |
<input type="checkbox" name="checkbox[]" value="3" /> Option 3 | |
</label> | |
</fieldset> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment