Yii Framework Forum: Yii2-Detail-View - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii2-Detail-View Various enhancements to the Yii 2 Detail View with ability to edit dat Rate Topic: -----

#1 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 652
  • Joined: 29-August 12

Posted 15 May 2014 - 06:08 AM

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.
0

#2 User is offline   sifa786 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 47
  • Joined: 12-February 13

Posted 16 October 2014 - 11:44 AM

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 :

PHP Fatal Error – yii\base\ErrorException
Cannot use object of type kartik\datecontrol\Module as array


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>

0

#3 User is offline   Kartik V 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 652
  • Joined: 29-August 12

Posted 25 October 2014 - 03:23 AM

View Postsifa786, on 16 October 2014 - 11:44 AM, said:

PHP Fatal Error – yii\base\ErrorException
Cannot use object of type kartik\datecontrol\Module as array


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'],


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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users