本文整理汇总了PHP中SearchForm::setFormAction方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchForm::setFormAction方法的具体用法?PHP SearchForm::setFormAction怎么用?PHP SearchForm::setFormAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchForm
的用法示例。
在下文中一共展示了SearchForm::setFormAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SearchPlusForm
function SearchPlusForm($name = "SearchForm", $fieldName = "Search", $fieldLabel = '')
{
$action = $this->getRequest()->param("Action");
$page = SearchPlusPage::get()->first();
if ($page) {
//!in_array($action, array("login", "logout")) &&
if (!$fieldLabel) {
if (isset($_REQUEST[$fieldName])) {
$searchText = $_REQUEST[$fieldName];
//we set $_REQUEST["Search"] below because it is also used by things like Text::ContextSummary
$_REQUEST["Search"] = $_REQUEST[$fieldName];
} elseif (isset($_REQUEST["Search"])) {
$searchText = $_REQUEST["Search"];
} else {
$searchText = 'Search';
}
} else {
$searchText = '';
}
$field = new TextField($fieldName, $fieldLabel, $searchText);
$fields = new FieldList($field);
$actions = new FieldList(new FormAction('results', 'Search'));
$form = new SearchForm($this, $name, $fields, $actions);
$form->setFormAction($page->Link() . "results/");
$form->setPageLength(Config::inst()->get("SearchPlusPage", "result_length"));
$form->unsetValidator();
return $form;
} elseif (!$page) {
user_error("You need to create a SearchPlusPage to have a search box", E_USER_NOTICE);
}
}
示例2: SpeakerSearchForm
public function SpeakerSearchForm()
{
$searchField = new TextField('mq', 'Search Speaker', $this->getSearchQuery());
$searchField->setAttribute("placeholder", "first name, last name or irc nickname");
$fields = new FieldList($searchField);
$form = new SearchForm($this, 'SpeakerSearchForm', $fields);
$form->setFormAction($this->Link('results'));
return $form;
}
示例3: SearchForm
/**
* Site search form.
*
* Similar to ContentControllerSearchExtension::SearchForm() but
* redirecting to a suitable page to avoid invalid URLs such as
* 'adg/AdgEntity.html/SearchForm'
*
* The default redirection is to '/home/SearchForm' but can be
* changed with GtkdocControllerSearcExtension::setSearchAction().
*/
public function SearchForm()
{
if ($this->owner->request && $this->owner->request->getVar('Search')) {
$searchText = $this->owner->request->getVar('Search');
} else {
$searchText = _t('SearchForm.SEARCH', 'Search');
}
$fields = new FieldList(new TextField('Search', false, $searchText));
$actions = new FieldList(new FormAction('results', _t('SearchForm.GO', 'Go')));
$form = new SearchForm($this->owner, 'SearchForm', $fields, $actions);
$form->classesToSearch(FulltextSearchable::get_searchable_classes());
// The following line is the reason of this overriding: we must
// redirect to a suitable page to avoid invalid URLs such as
// 'adg/AdgEntity.html/SearchForm'
$form->setFormAction(self::$search_action);
return $form;
}