本文整理汇总了PHP中Magento\Backend\Block\Widget\Grid\Extended::addColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Extended::addColumn方法的具体用法?PHP Extended::addColumn怎么用?PHP Extended::addColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Block\Widget\Grid\Extended
的用法示例。
在下文中一共展示了Extended::addColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
$this->_layoutMock = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\LayoutInterface');
$context = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Backend\\Block\\Template\\Context', ['layout' => $this->_layoutMock]);
$this->_block = $this->_layoutMock->createBlock('Magento\\Backend\\Block\\Widget\\Grid\\Extended', 'grid', ['context' => $context]);
$this->_block->addColumn('column1', ['id' => 'columnId1']);
$this->_block->addColumn('column2', ['id' => 'columnId2']);
}
示例2: addColumn
public function addColumn($columnId, $column)
{
if (is_array($column)) {
if (!array_key_exists('header_css_class', $column)) {
$column['header_css_class'] = 'grid-listing-column-' . $columnId;
}
if (!array_key_exists('column_css_class', $column)) {
$column['column_css_class'] = 'grid-listing-column-' . $columnId;
}
}
return parent::addColumn($columnId, $column);
}
示例3: addColumn
/**
* Add column to grid
* Overridden to add support for visibility_filter column option
* It stands for conditional visibility of the column depending on filter field values
* Value of visibility_filter supports (filter_field_name => filter_field_value) pairs
*
* @param string $columnId
* @param array $column
* @return $this
*/
public function addColumn($columnId, $column)
{
if (is_array($column) && array_key_exists('visibility_filter', $column)) {
$filterData = $this->getFilterData();
$visibilityFilter = $column['visibility_filter'];
if (!is_array($visibilityFilter)) {
$visibilityFilter = array($visibilityFilter);
}
foreach ($visibilityFilter as $k => $v) {
if (is_int($k)) {
$filterFieldId = $v;
$filterFieldValue = true;
} else {
$filterFieldId = $k;
$filterFieldValue = $v;
}
if (!$filterData->hasData($filterFieldId) || $filterData->getData($filterFieldId) != $filterFieldValue) {
return $this;
// don't add column
}
}
}
return parent::addColumn($columnId, $column);
}