当前位置: 首页>>代码示例>>PHP>>正文


PHP SearchForm::setFormAction方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-searchplus,代码行数:31,代码来源:SearchPlusSearchForm.php

示例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;
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:9,代码来源:SpeakerListPage.php

示例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;
 }
开发者ID:helpfulrobot,项目名称:entidi-silverstripe-gtkdoc,代码行数:27,代码来源:Gtkdoc.php


注:本文中的SearchForm::setFormAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。