/** * @return array */ private function _getHeaderCustomParams() { $result = []; if ($domain = Domain::findOne(['id' => $this->domain_id])) { if ($domain->desktopLogoUrl) { $result['logo_url'] = $domain->desktopLogoUrl; } if ($domain->mobileLogoUrl) { $result['m_logo_url'] = $domain->mobileLogoUrl; } } return $result; }
echo Yii::t('backend', 'Extend page'); ?> <span class="caret"></span> </button> <ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> <?php foreach ($list as $key => $value) { echo '<li><a href="/page/create?locale_group_id=' . $key . '&scenario=extend">' . $value . '</a></li>'; } ?> </ul> </span> <?php $columns = ['id', 'title', 'slug', 'status', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {log} {delete}', 'buttons' => ['log' => function ($url, $model) { $customurl = Yii::$app->getUrlManager()->createUrl(['timeline-event/index', 'TimelineEventSearch[category]' => 'common\\models\\locale\\Page', 'TimelineEventSearch[row_id]' => $model->id]); return Html::a('<span class="glyphicon glyphicon-time"></span>', $customurl, ['title' => Yii::t('yii', 'Log'), 'data-pjax' => '0']); }]]]; if (\Yii::$app->user->can('administrator')) { // adding after status array_splice($columns, 4, 0, [['attribute' => 'domain_id', 'content' => function ($model) { $domain = Domain::findOne($model->domain_id); $domain = $domain ? $domain->title : ''; return Html::tag('div', $model->domain_id, ['data-toggle' => 'tooltip', 'data-placement' => 'left', 'title' => $domain, 'style' => 'cursor:default;']); }]]); } echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $columns]); ?> </div>
/** * Finds the Domain model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Domain the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Domain::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }