Skip to content

Instantly share code, notes, and snippets.

@estefanionsantos
Created September 8, 2021 00:59
Show Gist options
  • Save estefanionsantos/eafd310006303a87252581d53bf616f6 to your computer and use it in GitHub Desktop.
Save estefanionsantos/eafd310006303a87252581d53bf616f6 to your computer and use it in GitHub Desktop.
text form rubricate
<?php
use Rubricate\Form\TextForm;
use Rubricate\Form\LabelForm;
use Rubricate\Element\CreateElement;
$div = new CreateElement('div');
$lab = new LabelForm('First Name:');
$txt = new TextForm('firstName', 'john');
$div->setAttribute('class', 'form-group');
$lab->setAttribute('for', 'firstName');
$txt->setAttribute('id', 'firstName');
$div->addChild($lab);
$div->addChild($txt);
echo $div->getElement();
/*
<div class="form-group">
<label for="firstName">First Name:</label>
<input type="text" name="firstName" value="john" id="firstName" />
</div>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment