/** * render the date range input fields */ public function render() { // check result of validity checks of parameters passed to this Input element $this->checkValidity(); // render the date range input fields $output = $this->postcode->render() . $this->houseNumber->render() . $this->houseNumberExtension->render(); $output .= $this->renderInvalidations(); return $output; }
/** * render the date input element * @return string */ public function render() { // check result of validity checks of parameters passed to this Input element $this->checkValidity(); // we will show/hide the container div for the text field and the image and not the text field and the image themselves $hidden = $this->getHidden() === true ? ' style="display:none;"' : ''; $this->setHidden(false); // the text field must have the selected values $this->text->setValue($this->value); $this->text->setSelected($this->selected); $this->text->setRenderWithLabel($this->renderWithLabel); $output = $this->renderLabel(array('class' => 'date-element')) . '<div id="' . $this->id . '-container" class="inputs-container date-element"' . $hidden . $this->renderStyle() . '>' . $this->text->render() . '</div>' . PHP_EOL; if (empty($this->disabled)) { $output .= $this->getJS() . PHP_EOL; } $output .= $this->renderInvalidations(); return $output; }
/** * test rendering of the label */ public function testRenderWithLabel() { $input = new TextInput('foo', 'val'); $render = $input->render(); $this->assertNotContains('<label', $render, 'if no label is set, none should be rendered'); $input->setLabel('some label'); $render = $input->render(); $this->assertContains('<label for="foo"', $render, 'by default Inputs are rendered with a label if they have one'); $input->setRenderWithLabel(false); $render = $input->render(); $this->assertNotContains('<label for="foo"', $render, 'if renderWithLabel is set to false, no label should be rendered.'); $input->setRenderWithLabel('invalid'); $this->assertFalse($input->getRenderWithLabel(), 'An invalid argument should not change the attribute'); }