Yii2-Detail-View

This is the forum for the yii2-detail-view extension for Yii framework 2.0

The extension includes various enhancements to the Yii 2 Detail View with ability to edit data and manage styles using BS3. Check documentation and complete demo.

Hi,

I have all my models and crud setup and working with DetailView. I now want to create a new view which renders two detail views, however, I get an error when I include the second view :

[i]PHP Fatal Error – yii\base\ErrorException

Cannot use object of type kartik\datecontrol\Module as array

[/i]

It fails in my second view on the line




'format'=>['date',(isset(Yii::$app->modules['datecontrol']['displaySettings']['date'])) ? Yii::$app->modules['datecontrol']['displaySettings']['date'] : 'd-m-Y'],



My hand-crafted view code is as follows:




<div class="container-fluid">

    <h1><?= Html::encode($this->title) ?></h1>


    <div class="row-fluid">

        <?php

          echo $this->render('/parent/view', ['model' => $model]);

        ?>

    </div>


    <div class="row-fluid">

        <div class="col-md-10 offset1">

            <?php

            foreach ($model->children as $child) {

                echo $this->render('/child/view', ['model' => $child]);

            }

            ?>

        </div>

    </div>


</div>



This probably is something to do with your code. You need to check your code where you are calling


Yii::$app->modules['datecontrol']['displaySettings']['date']

. Use the getModule function and an object oriented method instead of array method like you have.