public function init() { $this->name = \Yii::t('skeeks/shop/app', 'Stocks'); $this->modelShowAttribute = "name"; $this->modelClassName = CmsContentElement::className(); parent::init(); }
<? $dataProvider->setSort(['defaultOrder' => ['published_at' => SORT_DESC]]); $cmsContent = \Yii::$app->shop->storeContent; $content_id = $cmsContent->id; if ($content_id) { $dataProvider->query->andWhere(['content_id' => $content_id]); /** * @var $cmsContent \skeeks\cms\models\CmsContent */ $cmsContent = \skeeks\cms\models\CmsContent::findOne($content_id); $searchModel->content_id = $content_id; } $columns = \skeeks\cms\controllers\AdminCmsContentElementController::getColumns($cmsContent, $dataProvider); ?> <? $pjax = \yii\widgets\Pjax::begin(); ?> <?php echo $this->render('@skeeks/cms/views/admin-cms-content-element/_search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'content_id' => $content_id, 'cmsContent' => $cmsContent]); ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'autoColumns' => false, 'pjax' => $pjax, 'adminController' => $controller, 'settingsData' => ['namespace' => \Yii::$app->controller->action->getUniqueId() . $content_id], 'columns' => $columns]); ?> <? $pjax::end() ?> <? \yii\bootstrap\Alert::begin([
<? $childContents = $model->cmsContent->getChildrenContents()->andWhere(['!=', 'id', $shopContent->childrenContent->id])->all(); ?> <? foreach($childContents as $childContent) : ?> <?php echo $form->fieldSet($childContent->name); ?> <? if ($model->isNewRecord) : ?> <?php echo \yii\bootstrap\Alert::widget(['options' => ['class' => 'alert-warning'], 'body' => \Yii::t('skeeks/shop/app', 'Management will be available after saving')]); ?> <? else: ?> <?php echo \skeeks\cms\modules\admin\widgets\RelatedModelsGrid::widget(['label' => $childContent->name, 'namespace' => md5($model->className() . $childContent->id), 'parentModel' => $model, 'relation' => ['content_id' => $childContent->id, 'parent_content_element_id' => $model->id], 'sort' => ['defaultOrder' => ['priority' => 'published_at']], 'controllerRoute' => 'shop/admin-cms-content-element', 'gridViewOptions' => ['columns' => (array) \skeeks\cms\controllers\AdminCmsContentElementController::getColumns($childContent)]]); ?> <? endif; ?> <?php echo $form->fieldSetEnd(); ?> <? endforeach; ?> <? endif; ?>
$dataProvider->query->andWhere(['content_id' => $content_id]); /** * @var $cmsContent \skeeks\cms\models\CmsContent */ $cmsContent = \skeeks\cms\models\CmsContent::findOne($content_id); $searchModel->content_id = $content_id; } ?> <? $pjax = \yii\widgets\Pjax::begin(); ?> <?php echo $this->render('_search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'content_id' => $content_id, 'cmsContent' => $cmsContent]); ?> <?php echo \skeeks\cms\modules\admin\widgets\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'autoColumns' => false, 'pjax' => $pjax, 'adminController' => $controller, 'settingsData' => ['namespace' => \Yii::$app->controller->action->getUniqueId() . $content_id], 'columns' => \skeeks\cms\controllers\AdminCmsContentElementController::getColumns($cmsContent, $dataProvider)]); ?> <? \yii\widgets\Pjax::end(); ?> <? \yii\bootstrap\Alert::begin([ 'options' => [ 'class' => 'alert-info', ], ]); ?> Изменить свойства и права доступа к информационному блоку вы можете в <?php echo \yii\helpers\Html::a('Настройках контента', \skeeks\cms\helpers\UrlHelper::construct(['/cms/admin-cms-content/update', 'pk' => $content_id])->enableAdmin()->toString()); ?> . <? \yii\bootstrap\Alert::end(); ?>