當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Data::prepareFilterString方法代碼示例

本文整理匯總了PHP中Magento\Backend\Helper\Data::prepareFilterString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Data::prepareFilterString方法的具體用法?PHP Data::prepareFilterString怎麽用?PHP Data::prepareFilterString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Backend\Helper\Data的用法示例。


在下文中一共展示了Data::prepareFilterString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testPrepareFilterString

 /**
  * @covers \Magento\Backend\Helper\Data::prepareFilterString
  */
 public function testPrepareFilterString()
 {
     $expected = ['key1' => 'val1', 'key2' => 'val2', 'key3' => 'val3'];
     $filterString = base64_encode('key1=' . rawurlencode('val1') . '&key2=' . rawurlencode('val2') . '&key3=val3');
     $actual = $this->_helper->prepareFilterString($filterString);
     $this->assertEquals($expected, $actual);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:10,代碼來源:DataTest.php

示例2: _prepareCollection

 /**
  * Apply sorting and filtering to collection
  *
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 protected function _prepareCollection()
 {
     if ($this->getCollection()) {
         $this->_preparePage();
         $columnId = $this->getParam($this->getVarNameSort(), $this->_defaultSort);
         $dir = $this->getParam($this->getVarNameDir(), $this->_defaultDir);
         $filter = $this->getParam($this->getVarNameFilter(), null);
         if (is_null($filter)) {
             $filter = $this->_defaultFilter;
         }
         if (is_string($filter)) {
             $data = $this->_backendHelper->prepareFilterString($filter);
             $data = array_merge($data, (array) $this->getRequest()->getPost($this->getVarNameFilter()));
             $this->_setFilterValues($data);
         } elseif ($filter && is_array($filter)) {
             $this->_setFilterValues($filter);
         } elseif (0 !== sizeof($this->_defaultFilter)) {
             $this->_setFilterValues($this->_defaultFilter);
         }
         if ($this->getColumn($columnId) && $this->getColumn($columnId)->getIndex()) {
             $dir = strtolower($dir) == 'desc' ? 'desc' : 'asc';
             $this->getColumn($columnId)->setDir($dir);
             $this->_setCollectionOrder($this->getColumn($columnId));
         }
     }
     return $this;
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:33,代碼來源:Grid.php

示例3: testPrepareFilterStringValues

 /**
  * @param array $inputString
  * @param array $expected
  *
  * @dataProvider getPrepareFilterStringValuesDataProvider
  */
 public function testPrepareFilterStringValues(array $inputString, array $expected)
 {
     $inputString = base64_encode(http_build_query($inputString));
     $actual = $this->_helper->prepareFilterString($inputString);
     $this->assertEquals($expected, $actual);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:12,代碼來源:DataTest.php


注:本文中的Magento\Backend\Helper\Data::prepareFilterString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。