mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +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();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a rendered version of this form.
|
||||
*
|
||||
* This is returned when you access a form as $FormObject rather
|
||||
* than <% with FormObject %>
|
||||
*/
|
||||
public function forTemplate() {
|
||||
return $this->renderWith(array(
|
||||
'SearchForm',
|
||||
'Form'
|
||||
$return = $this->renderWith(array_merge(
|
||||
(array)$this->getTemplate(),
|
||||
array('SearchForm', 'Form')
|
||||
));
|
||||
|
||||
// Now that we're rendered, clear message
|
||||
$this->clearMessage();
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,6 +56,19 @@ class ZZZSearchFormTest extends FunctionalTest {
|
||||
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() {
|
||||
if(!$this->checkFulltextSupport()) return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user