/** * @covers HtmlElement::getBody */ public function testGetBody() { $body = "html body"; $elt = $this->element->setBody($body); $actual = $elt->getBody(); $this->assertInstanceOf("HtmlElement", $elt); $this->assertEquals($body, $actual); }
public function begin() { echo $this->getElementOpenTag() . "\n"; $legend = new HtmlElement("legend"); $legend->setBody($this->title); echo $legend; $this->started = true; }
/** * Dispaly a label for a field. * If the field is required, the css class 'required' will be added to * the label's element. * * @param $name string the field name * @param $title string the title to display. * @return HtmlElement */ public function label($name, $title) { $cssClasses = array(); $this->labels[$name] = $this->removeEndColon($title); $span = new HtmlElement("label"); $span->setBody($title); if ($this->findConstraint($name, ConstraintFactory::REQUIRED)) { $cssClasses[] = 'required'; } if (isset($this->field_errors[$name])) { $styleClass = Config::getInstance()->getString("webapp/ui/errorCssClass", "error"); $cssClasses[] = $styleClass; } if (count($cssClasses) > 0) { $span->set("class", implode(' ', $cssClasses)); } return $span; }