title: Yii2 Insert if else statement inside the dataGrid view
body: <p>I've created a website using yii2 framework. Also i used gii generator for my crud. Now i installed a extension kartik gridview. Now i want is inside the kartikGridview i want to create a if else statement but i got error. Yes i can do it but in outside the kartik gridview. Any suggestion guys?
  This is my index-gridview:</p>
  
  <pre><code>&lt;?=  GridView::widget([
  'id'=&gt;'kv-grid-demo',
  'dataProvider'=&gt;$dataProvider,
  'filterModel'=&gt;$searchModel,
  'columns'=&gt; [
          // ['class' =&gt; 'yii\grid\SerialColumn'],
          // 'report_id',
          'reference_no',
          'subject',
              [
                'attribute' =&gt; 'doc_date',
                'filter'=&gt;DatePicker::widget([
                'model' =&gt; $searchModel,
                'attribute' =&gt; 'doc_date',
                'removeButton' =&gt; false,
                 'pluginOptions' =&gt; [
                      'autoclose'=&gt;true,
                      'format' =&gt; 'yyyy-mm-dd',
                  ],
                  ])
              ],
  
              [
                  'attribute' =&gt; 'for',
                  'value' =&gt; 'namefor.fullName',
              ],
              [
                  'attribute' =&gt; 'from',
                  'value' =&gt; 'namefrom.fullName',
              ],
              [
              'attribute' =&gt; 'drawer_id',
  
              ],
              'user_id',
              'doc_name',
          // 'doc_file',
      [
      'class'    =&gt; 'yii\grid\ActionColumn',
  
      ],
      ],
  'containerOptions'=&gt;['style'=&gt;'overflow: auto'], // only set when $responsive = false
  'headerRowOptions'=&gt;['class'=&gt;'kartik-sheet-style'],
  'filterRowOptions'=&gt;['class'=&gt;'kartik-sheet-style'],
  'pjax'=&gt;true, // pjax is set to always true for this demo
  'panel' =&gt; [
  'type' =&gt; GridView::TYPE_PRIMARY,
  'heading' =&gt; '&lt;h3 class="panel-title"&gt;&lt;i class="fa fa-files-o"&gt;&lt;/i&gt; Documents&lt;/h3&gt;',
  'responsive'=&gt;true,
  'hover'=&gt;true,
  // 'after' =&gt; true,
  // 'showFooter' =&gt; true,
   'showFooter' =&gt; true,
  ],
  // set your toolbar
  
  'toolbar'=&gt; [
  
      // Html::button('&lt;i class="glyphicon glyphicon-plus"&gt;&lt;/i&gt;', ['type'=&gt;'button', 'title'=&gt;Yii::t('kvgrid', 'Add Book'), 'class'=&gt;'btn btn-success']) . ' '.
      '{export}',
      '{toggleData}',
  ],
  
  // set export properties
  'export'=&gt;[
      'fontAwesome'=&gt;true
  ],
  'exportConfig' =&gt; [
       GridView::PDF =&gt; [
  'filename' =&gt; 'Documents',
  'config' =&gt; [
    'methods' =&gt; [
      'SetHeader' =&gt; [
        ['odd' =&gt; $pdfHeader, 'even' =&gt; $pdfHeader]
      ],
      'SetFooter' =&gt; [
        ['odd' =&gt; $pdfFooter, 'even' =&gt; $pdfFooter]
      ],
    ],
    'options' =&gt; [
      'title' =&gt; 'Documents',
      'subject' =&gt; 'Documents',
      'keywords' =&gt; 'pdf, Documents, export, other, keywords, here'
    ],
  ]
  </code></pre>
  
  <p>How to insert this if else code?</p>
  
  <pre><code>  &lt;?php
       if(Yii::$app-&gt;user-&gt;identity-&gt;isUser()) 
       {
       }else{  ?&gt;
              &lt;p&gt;
              &lt;?=Html::a('&lt;i class="fa fa-plus"&gt;&lt;/i&gt;&amp;nbsp;Create',['create'],['class' =&gt; 'btn btn-success']) ?&gt;
              &lt;/p&gt;
        &lt;?php } ?&gt;
  </code></pre>
  
  <p>To this line?</p>
  
  <pre><code>'toolbar'=&gt; [
  
      '{export}',
      '{toggleData}',
  ],
  </code></pre>