예제 #1
0
파일: Grid.php 프로젝트: opexsw/magento2
 /**
  * Add column filtering conditions to collection
  *
  * @param \Magento\Backend\Block\Widget\Grid\Column $column
  * @return $this
  */
 protected function _addColumnFilterToCollection($column)
 {
     if ($this->getCollection()) {
         $field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
         if ($column->getFilterConditionCallback()) {
             call_user_func($column->getFilterConditionCallback(), $this->getCollection(), $column);
         } else {
             $condition = $column->getFilter()->getCondition();
             if ($field && isset($condition)) {
                 $this->getCollection()->addFieldToFilter($field, $condition);
             }
         }
     }
     return $this;
 }