diff --git a/crud/default/views/_expand.php b/crud/default/views/_expand.php index 749256f..3c272be 100644 --- a/crud/default/views/_expand.php +++ b/crud/default/views/_expand.php @@ -20,28 +20,33 @@ 'content' => $this->render('_detail', [ 'model' => $model, ]), - ], + ] +]; $rel): ?> skippedRelations)): ?> - [ - 'label' => ' '. Html::encode(generateString(Inflector::camel2words($rel[1])) ?>), - 'options' => ['id' => "tab__{$model->}"], - 'content' => $this->render('_data', [ - 'model' => $model, - 'row' => $model->, - ]), - ], + if (!empty($model->)) { + $items[] = + [ + 'label' => ' '. Html::encode(generateString(Inflector::camel2words($rel[1])) ?>), + 'options' => ['id' => "tab__{$model->}"], + 'content' => $this->render('_data', [ + 'model' => $model, + 'row' => $model->, + ]), + ]; + } - [ - 'label' => ' '. Html::encode(generateString(Inflector::camel2words($rel[1])) ?>), - 'options' => ['id' => "tab__{$model->}"], - 'content' => $this->render('_data', [ - 'model' => $model-> - ]), - ], + $items[] = + [ + 'label' => ' '. Html::encode(generateString(Inflector::camel2words($rel[1])) ?>), + 'options' => ['id' => "tab__{$model->}"], + 'content' => $this->render('_data', [ + 'model' => $model-> + ]), + ]; -]; + echo TabsX::widget([ 'items' => $items, 'position' => TabsX::POS_ABOVE,