/** * Renders out an optgroup and any child options * * @param Render $renderer * * @return string * * @since 2.0 */ public function render(Render $renderer) { $content = ''; foreach ($this->getContents() as $option) { $content .= "\n" . $renderer->render($option); } return Html::tag('optgroup', $this->getAttributes(), $content); }
/** * Should return a html string that represents the rendered object * * @param Render $renderer * * @return string * * @since 2.0 */ public function render(Render $renderer) { $elements = ''; foreach ($this->getContents() as $element) { $elements .= "\n" . $renderer->render($element); } return Html::tag('form', $this->getAttributes(), $elements); }
/** * @covers Fuel\Common\Html::tag * @group Common */ public function testTagWithAttributesAndContent() { $attributes = array('name' => 'foobar'); $content = 'This is some content!'; $tag = Html::tag('div', $attributes, $content); $expected = array('tag' => 'div', 'attributes' => $attributes, 'content' => $content); $this->assertTag($expected, $tag); }
/** * Renders the Fieldset to html * * @param Render $renderer * * @return string * * @since 2.0 */ public function render(Render $renderer) { $legend = ''; //Make sure the legend is added if needed if (!is_null($this->getLegend())) { $legend = Html::tag('legend', [], $this->getLegend()); } //Makes sure the legend is added if one exists $elements = $legend; //Render all the elements foreach ($this->getContents() as $element) { $elements .= "\n" . $renderer->render($element); } return Html::tag('fieldset', $this->getAttributes(), $elements); }
/** * Renders a generic input * * @param Render $renderer * * @return string "<input type="..." * * @since 2.0 */ public function render(Render $renderer) { return Html::tag('input', $this->getAttributes(), $this->getContents()); }
/** * Renders a submit with the appropriate classes. * * @param Submit $select * * @return string */ public function renderSubmit(Submit $select) { $attributes = $select->getAttributes(); if (!isset($attributes['class'])) { $attributes['class'] = ''; } $attributes['class'] .= ' btn btn-default'; return Html::tag('button', $attributes, $select->getValue()); }
/** * Renders the whole form, wrapping a table in <form> tags. * * @param Form $form * * @return string * * @since 2.0 */ public function renderForm(Form $form) { foreach ($form as $element) { $this->render($element); } $tableRender = new SimpleTable(); $tableContent = $tableRender->renderTable($this->table); return Html::tag('form', $form->getAttributes(), $tableContent); }