本文整理汇总了PHP中yii\grid\ActionColumn::renderDataCellContent方法的典型用法代码示例。如果您正苦于以下问题:PHP ActionColumn::renderDataCellContent方法的具体用法?PHP ActionColumn::renderDataCellContent怎么用?PHP ActionColumn::renderDataCellContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\grid\ActionColumn
的用法示例。
在下文中一共展示了ActionColumn::renderDataCellContent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
$dropdownId = $this->grid->getId() . '-dropdown2-menu-' . $index;
$this->template = implode(' ', array_keys(array_filter(['<li>{view}</li>' => ModelHelper::canRead($model), '<li>{update}</li>' => ModelHelper::canUpdate($model), '<li>{delete}</li>' => ModelHelper::canDelete($model)])));
$fix = ['~(glyphicon\\-eye\\-open"\\>\\</span\\>)(\\</a\\>)~i' => '$1 ' . Yii::t('mozayka', 'View') . '$2', '~(glyphicon\\-pencil"\\>\\</span\\>)(\\</a\\>)~i' => '$1 ' . Yii::t('mozayka', 'Update') . '$2', '~(glyphicon\\-trash"\\>\\</span\\>)(\\</a\\>)~i' => '$1 ' . Yii::t('mozayka', 'Delete') . '$2', '~\\s+title\\="[^"]*"~i' => '', '~\\s+data\\-confirm\\="[^"]*"~i' => '', '~\\s+data\\-method\\="[^"]*"~i' => ''];
$cellContent = preg_replace(array_keys($fix), array_values($fix), parent::renderDataCellContent($model, $key, $index));
// dropdown2-menu
if ($cellContent && $cellContent != $this->grid->emptyCell) {
$cellContent = Html::button('<span class="glyphicon glyphicon-cog"></span>', ['title' => Yii::t('mozayka', 'Actions'), 'class' => 'btn btn-default btn-xs', 'data-dropdown2' => '#' . $dropdownId]) . Html::tag('div', Html::tag('ul', $cellContent, ['class' => 'dropdown2-menu']), ['id' => $dropdownId, 'class' => 'dropdown2 dropdown2-tip' . (array_search($this, $this->grid->columns) + 1 > count($this->grid->columns) / 2 ? ' dropdown2-anchor-right' : '')]);
}
return $cellContent;
}
示例2: renderDataCellContent
/**
* Renders the data cell.
*/
protected function renderDataCellContent($model, $key, $index)
{
$content = parent::renderDataCellContent($model, $key, $index);
$options = $this->dropdownButton;
if ($this->_isDropdown) {
$label = ArrayHelper::remove($options, 'label', Yii::t('kvgrid', 'Actions'));
$caret = ArrayHelper::remove($options, 'caret', ' <span class="caret"></span>');
$options = ArrayHelper::merge($options, ['type' => 'button', 'data-toggle' => 'dropdown']);
Html::addCssClass($options, 'dropdown-toggle');
$button = Html::button($label . $caret, $options);
Html::addCssClass($this->dropdownMenu, 'dropdown-menu');
$dropdown = $button . PHP_EOL . Html::tag('ul', $content, $this->dropdownMenu);
return Html::tag('div', $dropdown, ['class' => 'dropdown']);
}
return $content;
}
示例3: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
$renderDataCellContent = parent::renderDataCellContent($model, $key, $index);
return Html::tag('div', $renderDataCellContent, ['class' => 'bk-elementActions']) . Html::tag('div', '', ['class' => 'clearfix']);
}
示例4: renderDataCellContent
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
//update the value of the template string for the current row
if ($this->templateInternal !== null) {
$this->template = call_user_func($this->templateInternal, $model, $key, $index);
}
return parent::renderDataCellContent($model, $key, $index);
}