mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUG: Fixed SearchForm not calling getTemplate() in forTemplate()
This commit is contained in:
parent
708e70624c
commit
9d888d5dde
@ -59,11 +59,23 @@ class SearchForm extends Form {
|
|||||||
$this->disableSecurityToken();
|
$this->disableSecurityToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a rendered version of this form.
|
||||||
|
*
|
||||||
|
* This is returned when you access a form as $FormObject rather
|
||||||
|
* than <% with FormObject %>
|
||||||
|
*/
|
||||||
public function forTemplate() {
|
public function forTemplate() {
|
||||||
return $this->renderWith(array(
|
$return = $this->renderWith(array_merge(
|
||||||
'SearchForm',
|
(array)$this->getTemplate(),
|
||||||
'Form'
|
array('SearchForm', 'Form')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Now that we're rendered, clear message
|
||||||
|
$this->clearMessage();
|
||||||
|
|
||||||
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,6 +56,19 @@ class ZZZSearchFormTest extends FunctionalTest {
|
|||||||
return $supports;
|
return $supports;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSearchFormTemplateCanBeChanged() {
|
||||||
|
if(!$this->checkFulltextSupport()) return;
|
||||||
|
|
||||||
|
$sf = new SearchForm($this->mockController, 'SearchForm');
|
||||||
|
|
||||||
|
$sf->setTemplate('BlankPage');
|
||||||
|
|
||||||
|
$this->assertContains(
|
||||||
|
'<body class="SearchForm Form RequestHandler BlankPage">',
|
||||||
|
$sf->forTemplate()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testPublishedPagesMatchedByTitle() {
|
public function testPublishedPagesMatchedByTitle() {
|
||||||
if(!$this->checkFulltextSupport()) return;
|
if(!$this->checkFulltextSupport()) return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user