How can I load code from a view of a different controller in each tab? Should I create a widget or there is a way to do it?
For example, in the Gridview::widget you can specify the controller for a button in ActionColumn:
['class' => 'yii\grid\ActionColumn',
'template' => '{view}',
'controller'=>'different-controller',
]
I’ve solved it. I don’t know if this is the better way, but it works.
In the controller of the view where is Tabs::widget:
public function actionView($id)
{
$cproyect = new ProyectController('proyect',$this->module);
$html_proyect = $cproyect->actionView($this->findModel($id)->idProyect->id_proyect);
return $this->render('view', [
'model' => $this->findModel($id),
'html_proyect' => $html_proyect
]);
}
And in the view:
echo Tabs::widget([
'items' => [
[
'label' => 'Proyect',
'content' => $html_proyect,
'active' => true
],
Please, if there is a better way, post it.