A very important widget in the business apps development is the GridView control. In this post I will show how to use its hidden capabilities to format the displayed data.
<?= GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => [ 'Title', // same as 'Title:text' 'Snippet:html', // will be HTML purified 'Description:ntext', // plaintext but new lines as <br> 'Email:email', // will be shown as mailto: link 'WebSite:url', // will be shown as hyperlink 'Picture:image', // <img src="value of Picture column" /> 'Maried:boolean', // true or false 'Birthdate:date', 'Birthdate:time', 'Birthdate:datetime', 'Birthdate:timestamp', 'Size:integer', 'Cost:spellout', // number as text 'DiskSize:size', // as bytes, for example `12 kilobytes` 'Size:decimal', 'Ratio:percent', ] ); ?>