Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * 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');
 }
Ejemplo n.º 3
0
 /**
  * (non-PHPdoc)
  * @see \WinkForm\Input\Input::isPosted()
  */
 public function isPosted()
 {
     $translator = Translator::getInstance();
     return $this->postcode->isPosted() && $this->houseNumber->isPosted() && $this->postcode->getPosted() != $translator->get('inputs.postal-code') && $this->houseNumber->getPosted() != $translator->get('inputs.house-number');
 }