本文整理汇总了PHP中yii\grid\DataColumn::renderDataCellContent方法的典型用法代码示例。如果您正苦于以下问题:PHP DataColumn::renderDataCellContent方法的具体用法?PHP DataColumn::renderDataCellContent怎么用?PHP DataColumn::renderDataCellContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\grid\DataColumn
的用法示例。
在下文中一共展示了DataColumn::renderDataCellContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
$text = parent::renderDataCellContent($model, $key, $index);
if (in_array($this->format, ['text', 'date', 'datetime'])) {
return Html::a($text, null, $this->grid->prepareDetailsLink($model->id));
}
return $text;
}
示例2: renderDataCellContent
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
if ($this->content === null) {
return Html::a('<span class="glyphicon glyphicon-arrow-up"></span>', $this->getUrl('up', $model), ['class' => 'order-link']) . Html::a('<span class="glyphicon glyphicon-arrow-down"></span>', $this->getUrl('down', $model), ['class' => 'order-link']);
} else {
return parent::renderDataCellContent($model, $key, $index);
}
}
示例3: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
if ($this->editable === true) {
return Html::tag('a', parent::renderDataCellContent($model, $key, $index), ['class' => 'editable']);
} else {
return parent::renderDataCellContent($model, $key, $index);
}
}
示例4: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
if ($this->content === null) {
return $this->getDataCellValue($model, $key, $index);
} else {
return parent::renderDataCellContent($model, $key, $index);
}
}
示例5: renderDataCellContent
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
$value = parent::renderDataCellContent($model, $key, $index);
if ($this->getDataCellValue($model, $key, $index) == true) {
return "<span class=\"label label-success\">{$value}</span>";
} else {
return "<span class=\"label label-default\">{$value}</span>";
}
}
示例6: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
$content = parent::renderDataCellContent($model, $key, $index);
if ($content == "1") {
return "<span class=\"label " . $this->true_label_class . "\">" . Yii::t('app', $this->true_value) . "</span>";
} else {
return "<span class=\"label " . $this->false_label_class . "\">" . Yii::t('app', $this->false_value) . "</span>";
}
}
示例7: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
$content = parent::renderDataCellContent($model, $key, $index);
$options = $this->grid->options;
if (array_key_exists('href', $options) && $options['href'] != null) {
$field = $options['field'];
$content = Html::tag('a', $content, ['href' => $options['href'] . "?" . $field . "=" . $model->{$field}, 'class' => 'btn-block']);
}
return $content;
}
示例8: renderDataCellContent
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
/** @var $model ActiveRecord */
if ($this->format == 'boolean') {
return Html::activeCheckbox($model, $this->attribute, ['label' => false, 'class' => 'ajax-checkbox', 'data' => ['id' => $key, 'modelName' => $model->className(), 'attribute' => $this->attribute]]);
}
if ($this->content === null) {
return $this->grid->formatter->format($this->getDataCellValue($model, $key, $index), $this->format);
} else {
return parent::renderDataCellContent($model, $key, $index);
}
}
示例9: renderDataCellContent
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
if ($this->content === null) {
$contentParts = [];
$variationBehavior = $this->getVariationBehavior($model);
foreach ($variationBehavior->getVariationModels() as $variationModel) {
$contentParts[] = '<tr><td><b>' . $this->getVariationLabel($model, $variationModel) . '</b></td><td>' . $this->getVariationValue($variationModel) . '</td>';
}
return Html::tag('table', implode("\n", $contentParts), $this->tableOptions);
}
return parent::renderDataCellContent($model, $key, $index);
}
示例10: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
$content = parent::renderDataCellContent($model, $key, $index);
if (null === $this->callback_wrapper) {
return $content;
}
if ($this->callback_wrapper instanceof \Closure) {
$_content = call_user_func($this->callback_wrapper, $content, $model, $key, $index, $this);
if (null !== $_content) {
return $_content;
}
}
return $content;
}
示例11: renderDataCellContent
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
$value = $model->{$this->attribute};
if (in_array($value, $this->infinity)) {
return "∞";
} else {
return $value;
}
if ($this->content === null) {
return $this->grid->formatter->format($this->getDataCellValue($model, $key, $index), $this->format);
} else {
return parent::renderDataCellContent($model, $key, $index);
}
}
示例12: renderDataCellContent
/**
*
* @param \yii\base\Model $model
* @param type $key
* @param type $index
* @return type
*/
protected function renderDataCellContent($model, $key, $index)
{
if ($this->value !== null) {
if (is_string($this->value)) {
$value = ArrayHelper::getValue($model, $this->value);
} else {
$value = call_user_func($this->value, $model, $index, $this);
}
} elseif ($this->content === null && $this->attribute !== null) {
$value = $this->renderInput($model, $index);
} else {
$value = parent::renderDataCellContent($model, $key, $index);
}
return strtr($this->template, ['{content}' => $value]);
}
示例13: renderDataCellContent
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
{
$url = $this->url;
if (!is_array($url)) {
$url = [$url];
}
foreach ($this->params as $n => $v) {
$url[$n] = $model->{$v};
}
if ($this->content === null) {
return Html::a($this->grid->formatter->format($this->getDataCellValue($model, $key, $index), $this->format), $url);
} else {
return Html::a(parent::renderDataCellContent($model, $key, $index), $url);
}
}
示例14: renderDataCellContent
protected function renderDataCellContent($model, $key, $index)
{
$content = \yii\grid\DataColumn::renderDataCellContent($model, $key, $index);
if ($this->titles) {
$value = ArrayHelper::getValue($this->titles, $content, $content);
} else {
$value = $content;
}
if ($this->labels) {
$content = Html::tag('span', $value, ['class' => 'label label-grid-view label-' . ArrayHelper::getValue($this->labels, $content, self::LABEL_DEFAULT)]);
} else {
$content = $value;
}
return $content;
}
示例15: renderDataCellContent
/**
* Renders the data cell content.
* @param mixed $model the data model
* @param mixed $key the key associated with the data model
* @param integer $index the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
* @return string the rendering result
*/
protected function renderDataCellContent($model, $key, $index)
{
if ($this->grid->runInConsoleMode) {
return parent::renderDataCellContent($model, $key, $index);
}
$attribute = $this->attribute;
$value = $model->{$attribute};
$url = [$this->action, 'id' => $model->id, 'attribute' => $attribute];
if ($value === null || $value == true) {
$icon = 'toggle-on';
$title = Yii::t('yii', 'Off');
} else {
$icon = 'toggle-off';
$title = Yii::t('yii', 'On');
}
return Html::a(Icons::i($icon . ' fa-lg'), $url, ['title' => $title, 'class' => 'grid-view-toggle-cell-link', 'data-method' => 'post', 'data-pjax' => '0']);
}