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


PHP SearchForm::classesToSearch方法代码示例

本文整理汇总了PHP中SearchForm::classesToSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchForm::classesToSearch方法的具体用法?PHP SearchForm::classesToSearch怎么用?PHP SearchForm::classesToSearch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SearchForm的用法示例。


在下文中一共展示了SearchForm::classesToSearch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SearchForm

 /**
  * Site search form
  */
 public function SearchForm()
 {
     $searchText = _t('SearchForm.SEARCH', 'Search');
     if ($this->owner->request && $this->owner->request->getVar('Search')) {
         $searchText = $this->owner->request->getVar('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());
     return $form;
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:15,代码来源:ContentControllerSearchExtension.php

示例2: ModuleSearchForm

 /**
  * Site search form
  */
 function ModuleSearchForm()
 {
     $searchText = _t('ModuleProductGroup.KEYWORDS', 'keywords');
     if ($this->request) {
         $searchText = $this->request->getVar('Search');
     }
     $fields = new FieldList(new TextField('Search', _t('ModuleProductGroup.KEYWORDS', 'keywords'), $searchText));
     $actions = new FieldList(new FormAction('modulesearchformresults', _t('ModuleSearchForm.FILTER', 'Filter')));
     $form = new SearchForm($this, 'ModuleSearchForm', $fields, $actions);
     $form->classesToSearch(array("SiteTree"));
     return $form;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce-software,代码行数:15,代码来源:ModuleProductGroup.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

示例4: getForm

 public function getForm($filters = true)
 {
     // Don't allow searching without a valid search engine.
     $engine = $this->data()->SearchEngine;
     $fulltext = Config::inst()->get('FulltextSearchable', 'searchable_classes');
     if (is_null($engine) || $engine === 'Full-Text' && (!is_array($fulltext) || count($fulltext) === 0)) {
         return $this->httpError(404);
     }
     // Construct the search form.
     $fields = new FieldList(TextField::create('Search', _t('SearchForm.SEARCH', 'Search'), isset($_GET['Search']) ? $_GET['Search'] : '')->addExtraClass('extensible-search search')->setAttribute('data-suggestions-enabled', Config::inst()->get('ExtensibleSearchSuggestion', 'enable_suggestions') ? 'true' : 'false')->setAttribute('data-extensible-search-page', $this->data()->ID));
     // When filters have been enabled, display these in the form.
     if ($filters) {
         $objFields = $this->data()->getSelectableFields();
         // Remove content and groups from being sortable (as they are not relevant).
         unset($objFields['Content']);
         unset($objFields['Groups']);
         // Remove any custom field types and display the sortable options nicely to the user.
         foreach ($objFields as &$field) {
             if ($customType = strpos($field, ':')) {
                 $field = substr($field, 0, $customType);
             }
             // Add spaces between words, other characters and numbers.
             $field = ltrim(preg_replace(array('/([A-Z][a-z]+)/', '/([A-Z]{2,})/', '/([_.0-9]+)/'), ' $0', $field));
         }
         $sortBy = isset($_GET['SortBy']) ? $_GET['SortBy'] : $this->data()->SortBy;
         $sortDir = isset($_GET['SortDir']) ? $_GET['SortDir'] : $this->data()->SortDir;
         $fields->push(new DropdownField('SortBy', _t('ExtensibleSearchPage.SORT_BY', 'Sort By'), $objFields, $sortBy));
         $fields->push(new DropdownField('SortDir', _t('ExtensibleSearchPage.SORT_DIR', 'Sort Direction'), $this->data()->dbObject('SortDir')->enumValues(), $sortDir));
     }
     $actions = new FieldList(new FormAction('getSearchResults', _t('SearchForm.GO', 'Search')));
     $form = new SearchForm($this, 'getForm', $fields, $actions);
     $searchable = Config::inst()->get('FulltextSearchable', 'searchable_classes');
     if (is_array($searchable) && count($searchable) > 0) {
         $form->classesToSearch($searchable);
     }
     $form->addExtraClass('searchPageForm');
     $form->setFormMethod('GET');
     $form->disableSecurityToken();
     return $form;
 }
开发者ID:helpfulrobot,项目名称:nglasl-silverstripe-extensible-search,代码行数:40,代码来源:ExtensibleSearchPage.php


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