mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
FIX: Search Form
This commit is contained in:
parent
3b770f2289
commit
f77f7acd55
@ -2,7 +2,10 @@
|
||||
|
||||
namespace A2nt\CMSNiceties\Extensions;
|
||||
|
||||
use A2nt\ElementalBasics\Models\TeamMember;
|
||||
use DNADesign\Elemental\Models\ElementalArea;
|
||||
use DNADesign\Elemental\Models\ElementContent;
|
||||
use DNADesign\ElementalUserForms\Control\ElementFormController;
|
||||
use Page;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Control\Controller;
|
||||
@ -153,7 +156,13 @@ class PageControllerEx extends Extension
|
||||
RequiredFields::create(['q'])
|
||||
)->setFormMethod('GET');
|
||||
|
||||
$form->setLegend('Search ' . $config->getField('Title') . ' Website');
|
||||
$homePage = SiteTree::get()->filter('URLSegment', 'home')->first();
|
||||
if ($homePage) {
|
||||
$link = $homePage->Link();
|
||||
$link = ($link === '/') ? '/home/' : $link;
|
||||
$form->setFormAction($link);
|
||||
}
|
||||
$form->setLegend('Search at ' . $config->getField('Title'));
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user