当前位置: 首页>>代码示例>>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;未经允许,请勿转载。