mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Alleviate the Search Widget of its need for a <form> tag
This commit is contained in:
parent
33922f2180
commit
df26e201df
@ -102,7 +102,7 @@ class Search extends WidgetBase
|
||||
/*
|
||||
* Save or reset search term in session
|
||||
*/
|
||||
$this->setActiveTerm(post('term'));
|
||||
$this->setActiveTerm(post($this->getName()));
|
||||
|
||||
/*
|
||||
* Trigger class event, merge results as viewable array
|
||||
@ -133,4 +133,13 @@ class Search extends WidgetBase
|
||||
|
||||
$this->activeTerm = $term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a value suitable for the field name property.
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->alias . '[term]';
|
||||
}
|
||||
}
|
@ -1,17 +1,13 @@
|
||||
<?= Form::ajax($this->getEventHandler('onSubmit')) ?>
|
||||
|
||||
<div class="loading-indicator-container size-input-text">
|
||||
<input
|
||||
placeholder="<?= $placeholder ?>"
|
||||
type="text"
|
||||
name="term"
|
||||
value="<?= $value ?>"
|
||||
data-request="<?= $this->getEventHandler('onSubmit') ?>"
|
||||
data-track-input
|
||||
data-load-indicator
|
||||
data-load-indicator-opaque
|
||||
class="form-control <?= $cssClasses ?>"
|
||||
autocomplete="off" />
|
||||
</div>
|
||||
|
||||
<?= Form::close() ?>
|
||||
<div class="loading-indicator-container size-input-text">
|
||||
<input
|
||||
placeholder="<?= $placeholder ?>"
|
||||
type="text"
|
||||
name="<?= $this->getName() ?>"
|
||||
value="<?= $value ?>"
|
||||
data-request="<?= $this->getEventHandler('onSubmit') ?>"
|
||||
data-track-input
|
||||
data-load-indicator
|
||||
data-load-indicator-opaque
|
||||
class="form-control <?= $cssClasses ?>"
|
||||
autocomplete="off" />
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user