title: Yii2 GridView column data as link to related table attribute
body: <p>I am trying to have <code>GridView</code> with one column in url link type. This one column is from relation in model <code>Region</code> (as <code>region_type</code> - FK), specifically name attribute of this related table. In this <code>GridView</code> I got no problem to get value of name of these related table, but problem is to provide them as link format instead of plain name. I set <code>parentRegion.name</code> as relation attribute in RegionSearch model.</p>
  
  <p><strong>View</strong>:</p>
  
  <pre><code>&lt;?= GridView::widget([
          'dataProvider' =&gt; $dataProvider,
          'filterModel' =&gt; $searchModel,
          'columns' =&gt; [
              ['class' =&gt; 'yii\grid\SerialColumn'],
  
              [
                  'label' =&gt; 'View parent',
                  'format' =&gt; 'raw',
                  // here comes the problem - instead of parent_region I need to have parent
                  'value' =&gt; function ($dataProvider) {
                       return Html::a('view', '/admin/region/view?id=' . $dataProvider-&gt;parent_region);
                   },
              ],
  
              'parentRegion.name',  // this is what I want to display in link value - name of this related data
  
  
              ['class' =&gt; 'yii\grid\ActionColumn'],
          ],
      ]); ?&gt;
  </code></pre>
  
  <p><strong>RegionSearch</strong>:</p>
  
  <pre><code>public function attributes()
  {
              // add related fields to searchable attributes
              return array_merge(parent::attributes(), ['parentRegion', 'regionType']);
  }
  
  public function search($params)
  {
      $query = Region::find();
  
      $dataProvider = new ActiveDataProvider([
          'query' =&gt; $query,
      ]);
  
      $query-&gt;joinWith(['parentRegion' =&gt; function($query) { $query-&gt;from(['parentRegion' =&gt; 'region']); }]);
      $dataProvider-&gt;sort-&gt;attributes['parentRegion'] = [
          'asc' =&gt; ['parentRegion' =&gt; SORT_ASC],
          'desc' =&gt; ['parentRegion' =&gt; SORT_DESC],
      ];
  
      $this-&gt;load($params);
  
      if (!$this-&gt;validate()) {
          // uncomment the following line if you do not want to return any records when validation fails
          // $query-&gt;where('0=1');
          return $dataProvider;
      }
  
      $query-&gt;andFilterWhere(['like', 'name', $this-&gt;name])
          -&gt;andFilterWhere(['like', 'parentRegion', $this-&gt;getAttribute('parentRegion')])
  
      return $dataProvider;
  }
  </code></pre>
  
  <p>Could you please help me how to get this property name (attribute of related table) to this <code>GridView</code> as link?</p>