Skip to content

Instantly share code, notes, and snippets.

@estefanionsantos
Last active September 8, 2021 00:53
Show Gist options
  • Save estefanionsantos/b4da10b1fede9d5cab5b1c8f4ace21fd to your computer and use it in GitHub Desktop.
Save estefanionsantos/b4da10b1fede9d5cab5b1c8f4ace21fd to your computer and use it in GitHub Desktop.
radio form rubricate
<?php
use Rubricate\Form\LabelForm;
use Rubricate\Form\RadioForm;
for ($i = 1; $i <= 3; $i++) {
$radio = new RadioForm('optradio', $i);
$radio->checked(2);
$label = new LabelForm(
$radio->getElement() . 'Option ' . $i
);
echo $label->getElement();
}
/*
<label>
<input type="radio" name="optradio" value="1" />
Option 1
</label>
<label>
<input type="radio" name="optradio" value="2" checked="checked" />
Option 2
</label>
<label>
<input type="radio" name="optradio" value="3" />
Option 3
</label>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment