Skip to content

Instantly share code, notes, and snippets.

@estefanionsantos
Created September 8, 2021 00:55
Show Gist options
  • Save estefanionsantos/f3390a60b67a2536e5c6658d329a024a to your computer and use it in GitHub Desktop.
Save estefanionsantos/f3390a60b67a2536e5c6658d329a024a to your computer and use it in GitHub Desktop.
select form rubricate
<?php
use Rubricate\Form\SelectForm;
use Rubricate\Form\OptionForm;
$select = new SelectForm('latim');
$select->setAttribute('class', 'sel_lorem');
$opt[] = 'choose';
$opt[] = 'lorem';
$opt[] = 'ipsum';
$opt[] = 'dolor';
/*
select option:
new OptionForm($opt, 1) ;
*/
$select->addChild(new OptionForm($opt));
echo $select->getElement();
/*
<select name="latim" class="sel_lorem">
<option value="0">choose</option>
<option value="1">lorem</option>
<option value="2">ipsum</option>
<option value="3">dolor</option>
</select>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment