private function addHelpForm() { $message = $this->htmlFormBuilder->getMessageBuilder()->getMessage($this->findMessageKeyFor($this->editPage->getTitle()->getNamespace()))->parse(); $html = $this->htmlFormBuilder->setName('editpage-help')->addParagraph($message, array('class' => 'smw-editpage-help'))->getForm(); $this->editPage->editFormPageTop .= $html; return true; }
private function getHtmlForm($resultMessage, $resultCount) { // Precaution to avoid any inline breakage caused by a div element // within a paragraph (e.g Highlighter content) $resultMessage = str_replace('div', 'span', $resultMessage); $html = $this->htmlFormBuilder->setName('searchbyproperty')->withFieldset()->addParagraph($resultMessage)->addPaging($this->pageRequestOptions->limit, $this->pageRequestOptions->offset, $resultCount)->addHorizontalRule()->addInputField($this->messageBuilder->getMessage('smw_sbv_property')->text(), 'property', $this->pageRequestOptions->propertyString, 'smw-property-input')->addNonBreakingSpace()->addInputField($this->messageBuilder->getMessage('smw_sbv_value')->text(), 'value', $this->pageRequestOptions->valueString, 'smw-value-input')->addNonBreakingSpace()->addSubmitButton($this->messageBuilder->getMessage('smw_sbv_submit')->text())->getForm(); return $html; }
public function testCheckbox() { $title = $this->getMockBuilder('\\Title')->disableOriginalConstructor()->getMock(); $message = $this->getMockBuilder('\\Message')->disableOriginalConstructor()->getMock(); $message->expects($this->any())->method('text')->will($this->returnValue('SomeText')); $messageBuilder = $this->getMockBuilder('\\SMW\\MediaWiki\\MessageBuilder')->disableOriginalConstructor()->getMock(); $messageBuilder->expects($this->any())->method('getMessage')->will($this->returnValue($message)); $instance = new HtmlFormBuilder($title, $messageBuilder); $instance->setName('checkboxForm')->addHeader('invalidLevel', 'someHeader')->withFieldset()->setMethod('post')->setActionUrl('http://example.org/foo')->addCheckbox('checkboxLabel', 'checkboxName', true, 'checkBoxId'); $expected = array('<form id="smw-form-checkboxForm" name="checkboxForm" method="post" action="http://example.org/foo">', '<h2>someHeader</h2>', '<fieldset id="smw-form-fieldset-checkboxForm">', '<input name="checkboxName" type="checkbox" value="1" checked="checked" id="checkboxName" class="smw-form-checkbox" />', '<label for="checkboxName" class="smw-form-checkbox">checkboxLabel</label>'); $this->stringValidator->assertThatStringContains($expected, $instance->getForm()); }