• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Grid\Column类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Backend\Block\Widget\Grid\Column的典型用法代码示例。如果您正苦于以下问题:PHP Column类的具体用法?PHP Column怎么用?PHP Column使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: 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


示例2: 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


示例3: _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


示例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: testRender

 /**
  * @param bool $editable
  * @param bool $onlyEdit
  * @param string $expectedResult
  * @return void
  * @dataProvider renderDataProvider
  */
 public function testRender($editable, $onlyEdit, $expectedResult)
 {
     $value = 'some value';
     $keyValue = 'key';
     $this->columnMock->expects($this->once())->method('getEditable')->willReturn($editable);
     $this->columnMock->expects($this->any())->method('getEditOnly')->willReturn($onlyEdit);
     $this->columnMock->expects($this->any())->method('getIndex')->willReturn($keyValue);
     $this->columnMock->expects($this->any())->method('getId')->willReturn('test');
     $this->dataObjectMock->expects($this->any())->method('getData')->with($keyValue)->willReturn($value);
     $this->renderer->setColumn($this->columnMock);
     $this->assertEquals($expectedResult, $this->renderer->render($this->dataObjectMock));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:AbstractRendererTest.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)
 {
     // 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


示例8: __construct

 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, array $data = [])
 {
     $this->_rendererTypes['options'] = 'Magento\\Backend\\Block\\Widget\\Grid\\Column\\Renderer\\Options\\Extended';
     $this->_filterTypes['options'] = 'Magento\\Backend\\Block\\Widget\\Grid\\Column\\Filter\\Select\\Extended';
     $this->_rendererTypes['select'] = 'Magento\\Backend\\Block\\Widget\\Grid\\Column\\Renderer\\Select\\Extended';
     $this->_rendererTypes['checkbox'] = 'Magento\\Backend\\Block\\Widget\\Grid\\Column\\Renderer\\Checkboxes\\Extended';
     $this->_rendererTypes['radio'] = 'Magento\\Backend\\Block\\Widget\\Grid\\Column\\Renderer\\Radio\\Extended';
     parent::__construct($context, $data);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:Extended.php


示例9: _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


示例10: _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


示例11: _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


示例12: testGetHtmlSuccessfulTimestamp

 public function testGetHtmlSuccessfulTimestamp()
 {
     $uniqueHash = 'H@$H';
     $id = 3;
     $format = 'mm/dd/yyyy';
     $yesterday = new \DateTime();
     $yesterday->add(\DateInterval::createFromDateString('yesterday'));
     $tomorrow = new \DateTime();
     $tomorrow->add(\DateInterval::createFromDateString('tomorrow'));
     $value = ['locale' => 'en_US', 'from' => $yesterday->getTimestamp(), 'to' => $tomorrow->getTimestamp()];
     $this->mathRandomMock->expects($this->any())->method('getUniqueHash')->willReturn($uniqueHash);
     $this->columnMock->expects($this->once())->method('getHtmlId')->willReturn($id);
     $this->localeDateMock->expects($this->any())->method('getDateFormat')->willReturn($format);
     $this->columnMock->expects($this->any())->method('getTimezone')->willReturn(false);
     $this->localeResolverMock->expects($this->any())->method('getLocale')->willReturn('en_US');
     $this->model->setColumn($this->columnMock);
     $this->model->setValue($value);
     $output = $this->model->getHtml();
     $this->assertContains('id="' . $uniqueHash . '_from" value="' . $yesterday->getTimestamp(), $output);
     $this->assertContains('id="' . $uniqueHash . '_to" value="' . $tomorrow->getTimestamp(), $output);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:21,代码来源:DateTest.php


示例13: _addColumnFilterToCollection

 /**
  * @param \Magento\Backend\Block\Widget\Grid\Column $column
  * @return $this
  */
 protected function _addColumnFilterToCollection($column)
 {
     if ($this->getCollection()) {
         if ($column->getId() == 'websites') {
             $this->getCollection()->joinField('websites', 'catalog_product_website', 'website_id', 'product_id=entity_id', null, 'left');
         }
     }
     return parent::_addColumnFilterToCollection($column);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:13,代码来源:Grid.php


示例14: _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


示例15: _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


示例16: _setCollectionOrder

 /**
  * Sets sorting order by some column
  *
  * @param \Magento\Backend\Block\Widget\Grid\Column $column
  * @return $this
  */
 protected function _setCollectionOrder($column)
 {
     $collection = $this->getCollection();
     if ($collection) {
         $columnIndex = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
         $collection->setOrder($columnIndex, strtoupper($column->getDir()));
     }
     return $this;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:15,代码来源:Grid.php


示例17: _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


示例18: testSetGetGrid

 public function testSetGetGrid()
 {
     /**
      * Check that getFilter will be executed
      */
     $this->_layoutMock->expects($this->once())->method('createBlock')->with('StdClass')->will($this->returnValue($this->_blockMock));
     $this->_block->setFilter('StdClass');
     $grid = new \StdClass();
     $this->_block->setGrid($grid);
     $this->assertEquals($grid, $this->_block->getGrid());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:ColumnTest.php


示例19: __construct

 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, array $data = [])
 {
     parent::__construct($context, $data);
     $this->_cacheTypeList = $cacheTypeList;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:Statuses.php


示例20: __construct

 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, array $data = [])
 {
     parent::__construct($context, $data);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:8,代码来源:Multistore.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Grid\Container类代码示例发布时间:2022-05-23
下一篇:
PHP Form\Generic类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap