public function testGenerateInput() { FormGenerator::start('text'); FormGenerator::addName('AnyInputName'); $itemsArray = ['AnyElement' => 'AnyValue']; FormGenerator::addItem($itemsArray); FormGenerator::required(); $this->assertEquals('<input type="text" name="AnyInputName" required AnyElement="AnyValue">', FormGenerator::render()); }
/** * * @param array $customItem * @return string */ public function inputSearch(array $customItem = null) : string { FormGenerator::start('text'); FormGenerator::addName('search'); FormGenerator::addItem(['class' => 'form-control']); FormGenerator::addItem($customItem); FormGenerator::required(); return FormGenerator::render(); }
/** * * @param string $name */ private function addAccountValue(string $name) { if ($this->formAction === 'accountData') { $entityGetter = $this->getEntityGetter($name); FormGenerator::addItem(['value' => $this->user->getUserSession()->{$entityGetter}()]); } }