title: Yii2 ListView custom data-attribute based on currend DP model
body: <p>I need to set custom data-attribute to the ListView elements. As example I try to get current DataProvider model id. But I still view error "htmlspecialchars() expects parameter 1 to be string, object given". Please check my code and halp me - how I should get this ID? </p>
  
  <pre><code> &lt;?= ListView::widget([
              'dataProvider' =&gt; $photoProvider,
              'id' =&gt; 'photo-list',
              'itemView' =&gt; '_photoListItem',
              'viewParams' =&gt; [
                  'fullView' =&gt; true,
              ],
              'options' =&gt; [
                  'tag' =&gt; 'ul',
                  'class' =&gt; 'list-view'
              ],
              'itemOptions' =&gt; [
                  'tag' =&gt; 'li',
                  'class' =&gt; 'item',
                  'data' =&gt;[
                      'test' =&gt; function ($model, $key, $index, $widget) {
                          return Html::encode($model-&gt;id);
                      }
                  ]
              ],
              'pager' =&gt; [
                  'class' =&gt; ScrollPager::className(),
                  'container' =&gt; '#photo-list',
                  'item' =&gt; '.item',
                  'triggerText' =&gt; '&lt;div class="btn more"&gt;Load More&lt;/div&gt;',
                  'noneLeftText' =&gt; '',
                  'triggerOffset' =&gt; 2,
                  'negativeMargin' =&gt; 200
              ],
              'layout' =&gt; "{items}\n{pager}",
          ]);
          ?&gt;
  </code></pre>