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


PHP Column::getFilter方法代碼示例

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


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

示例1: addIsUsedFilterCallback

 /**
  * Callback function that filters collection by field "Used" from grid
  *
  * @param AbstractCollection $collection
  * @param Column $column
  * @return void
  */
 public function addIsUsedFilterCallback($collection, $column)
 {
     $filterValue = $column->getFilter()->getCondition();
     $expression = $this->getConnection()->getCheckSql('main_table.times_used > 0', 1, 0);
     $conditionSql = $this->_getConditionSql($expression, $filterValue);
     $collection->getSelect()->where($conditionSql);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:14,代碼來源:Collection.php

示例2: _filterStoreCondition

 /**
  * @param \Magento\Framework\Data\Collection $collection
  * @param \Magento\Backend\Block\Widget\Grid\Column $column
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 protected function _filterStoreCondition($collection, $column)
 {
     if (!($value = $column->getFilter()->getValue())) {
         return;
     }
     $this->getCollection()->addStoreFilter($value);
 }
開發者ID:hientruong90,項目名稱:magento2_installer,代碼行數:13,代碼來源:Grid.php

示例3: filterTermsCondition

 /**
  * Apply term filter
  *
  * @param \Magento\Framework\Data\Collection        $collection The collection
  * @param \Magento\Backend\Block\Widget\Grid\Column $column     Columns to filter
  */
 protected function filterTermsCondition($collection, $column)
 {
     if (!($value = $column->getFilter()->getValue())) {
         return;
     }
     $collection->setTermFilter($value);
 }
開發者ID:smile-sa,項目名稱:elasticsuite,代碼行數:13,代碼來源:Grid.php

示例4: filterStoreCondition

 /**
  * filter by store
  *
  * @param Collection $collection
  * @param Column $column
  * @return $this
  */
 public function filterStoreCondition(Collection $collection, Column $column)
 {
     if (!($value = $column->getFilter()->getValue())) {
         return $this;
     }
     $collection->addStoreFilter($value);
     return $this;
 }
開發者ID:nhc,項目名稱:Magento2SampleModule,代碼行數:15,代碼來源:DataSource.php

示例5: _addColumnFilterToCollection

 /**
  * @param Column $column
  * @return $this
  */
 protected function _addColumnFilterToCollection($column)
 {
     // Set custom filter for in category flag
     if ($column->getId() == 'in_category') {
         $productIds = $this->_getSelectedProducts();
         if (empty($productIds)) {
             $productIds = 0;
         }
         if ($column->getFilter()->getValue()) {
             $this->getCollection()->addFieldToFilter('entity_id', ['in' => $productIds]);
         } elseif (!empty($productIds)) {
             $this->getCollection()->addFieldToFilter('entity_id', ['nin' => $productIds]);
         }
     } else {
         parent::_addColumnFilterToCollection($column);
     }
     return $this;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:22,代碼來源:Product.php

示例6: _addColumnFilterToCollection

 /**
  * @param Column $column
  * @return $this
  */
 protected function _addColumnFilterToCollection($column)
 {
     // Set custom filter for in product flag
     if ($column->getId() == 'in_products') {
         $selected = $this->_getSelectedProducts();
         if (empty($selected)) {
             $selected = '';
         }
         if ($column->getFilter()->getValue()) {
             $this->getCollection()->addFieldToFilter('sku', ['in' => $selected]);
         } else {
             $this->getCollection()->addFieldToFilter('sku', ['nin' => $selected]);
         }
     } else {
         parent::_addColumnFilterToCollection($column);
     }
     return $this;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:22,代碼來源:Sku.php

示例7: _addColumnFilterToCollection

 /**
  * @param Column $column
  * @return $this
  */
 protected function _addColumnFilterToCollection($column)
 {
     if ($column->getId() == 'in_role_users') {
         $inRoleIds = $this->getUsers();
         if (empty($inRoleIds)) {
             $inRoleIds = 0;
         }
         if ($column->getFilter()->getValue()) {
             $this->getCollection()->addFieldToFilter('user_id', ['in' => $inRoleIds]);
         } else {
             if ($inRoleIds) {
                 $this->getCollection()->addFieldToFilter('user_id', ['nin' => $inRoleIds]);
             }
         }
     } else {
         parent::_addColumnFilterToCollection($column);
     }
     return $this;
 }
開發者ID:hientruong90,項目名稱:magento2_installer,代碼行數:23,代碼來源:User.php

示例8: _addColumnFilterToCollection

 /**
  * @param Column $column
  * @return $this
  */
 protected function _addColumnFilterToCollection($column)
 {
     if ($column->getId() == 'assigned_user_role') {
         $userRoles = $this->getSelectedRoles();
         if (empty($userRoles)) {
             $userRoles = 0;
         }
         if ($column->getFilter()->getValue()) {
             $this->getCollection()->addFieldToFilter('role_id', array('in' => $userRoles));
         } else {
             if ($userRoles) {
                 $this->getCollection()->addFieldToFilter('role_id', array('nin' => $userRoles));
             }
         }
     } else {
         parent::_addColumnFilterToCollection($column);
     }
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:23,代碼來源:Roles.php

示例9: _addColumnFilterToCollection

 /**
  * Add filter
  *
  * @param Column $column
  * @return $this
  */
 protected function _addColumnFilterToCollection($column)
 {
     // Set custom filter for in post flag
     if ($column->getId() == 'in_posts') {
         $postIds = $this->_getSelectedPosts();
         if (empty($postIds)) {
             $postIds = 0;
         }
         if ($column->getFilter()->getValue()) {
             $this->getCollection()->addFieldToFilter('post_id', ['in' => $postIds]);
         } else {
             if ($postIds) {
                 $this->getCollection()->addFieldToFilter('post_id', ['nin' => $postIds]);
             }
         }
     } else {
         parent::_addColumnFilterToCollection($column);
     }
     return $this;
 }
開發者ID:samitrimal,項目名稱:Blog-Extension-for-Magento-2,代碼行數:26,代碼來源:RelatedPosts.php

示例10: _addColumnFilterToCollection

 /**
  * Filter checked/unchecked rows in grid
  *
  * @param Column $column
  * @return $this
  */
 protected function _addColumnFilterToCollection($column)
 {
     if ($column->getId() == 'in_products') {
         $selected = $this->getSelectedProducts();
         if ($column->getFilter()->getValue()) {
             $this->getCollection()->addFieldToFilter('entity_id', ['in' => $selected]);
         } else {
             $this->getCollection()->addFieldToFilter('entity_id', ['nin' => $selected]);
         }
     } else {
         parent::_addColumnFilterToCollection($column);
     }
     return $this;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:20,代碼來源:Chooser.php

示例11: _addColumnFilterToCollection

 /**
  * @param \Magento\Backend\Block\Widget\Grid\Column $column
  * @return $this
  */
 protected function _addColumnFilterToCollection($column)
 {
     if ($column->getId() == 'in_articles') {
         $articleIds = $this->_getSelectedArticles();
         if (empty($articleIds)) {
             $articleIds = 0;
         }
         if ($column->getFilter()->getValue()) {
             $this->getCollection()->addFieldToFilter('article_id', ['in' => $articleIds]);
         } else {
             if ($articleIds) {
                 $this->getCollection()->addFieldToFilter('article_id', ['nin' => $articleIds]);
             }
         }
     } else {
         parent::_addColumnFilterToCollection($column);
     }
     return $this;
 }
開發者ID:pleminh,項目名稱:Gemtoo,代碼行數:23,代碼來源:Article.php

示例12: testGetFilterWhenFilterWasSetPreviously

 /**
  * @covers \Magento\Backend\Block\Widget\Grid\Column::getFilter
  * @covers \Magento\Backend\Block\Widget\Grid\Column::setFilter
  */
 public function testGetFilterWhenFilterWasSetPreviously()
 {
     $this->_layoutMock->expects($this->once())->method('createBlock')->with('StdClass')->will($this->returnValue($this->_blockMock));
     $this->_block->setFilter('StdClass');
     $this->assertNotEmpty($this->_block->getFilter());
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:10,代碼來源:ColumnTest.php

示例13: _addColumnFilterToCollection

 /**
  * @param \Magento\Backend\Block\Widget\Grid\Column $column
  * @return $this
  */
 protected function _addColumnFilterToCollection($column)
 {
     if ($column->getId() == 'in_topics') {
         $topicIds = $this->_getSelectedTopics();
         if (empty($topicIds)) {
             $topicIds = 0;
         }
         if ($column->getFilter()->getValue()) {
             $this->getCollection()->addFieldToFilter('main_table.topic_id', ['in' => $topicIds]);
         } else {
             if ($topicIds) {
                 $this->getCollection()->addFieldToFilter('main_table.topic_id', ['nin' => $topicIds]);
             }
         }
     } else {
         parent::_addColumnFilterToCollection($column);
     }
     return $this;
 }
開發者ID:mageplaza,項目名稱:magento-2-blog-extension,代碼行數:23,代碼來源:Topic.php


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