PHP code example of denisok94 / yii2-widgets
1. Go to this page and download the library: Download denisok94/yii2-widgets library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
denisok94 / yii2-widgets example snippets
use denisok94\yii2\widgets\NavTabs;
echo NavTabs::widget(['tabs' => [
'1' => [
'label' => 'label 1',
'content' => 'content text 1',
],
'2' => [
'label' => 'label 2',
'content' => 'content text 2',
],
'3' => [
'label' => 'label 3',
'content' => 'content 3',
'disabled' => true
],
//...
]])
echo NavTabs::widget(['tabs' => [
'overview' => [
'label' => 'Обзор',
'content' => $this->render('_overview', [
'model' => $model,
])
],
'story' => [
'label' => 'История',
'content' => $this->render('_story', [
'model' => $model,
])
],
'outfit' => [
'label' => 'Одежда',
'content' => $this->render('_outfit', [
'model' => $model,
]),
'disabled' => true
],
]]);
use denisok94\yii2\widgets\Box;
Box::begin([
'type' => 'primary', // solid / default / primary / success / warning / danger / info
'title' => 'Box title text',
'footer' => 'Box footer text', // or ~ $this->render('_footer', ['model' => $model])
'collapse' => true, // show button collapse
'remove' => true, // show button remove
]);
use denisok94\yii2\widgets\BlokFiles;
echo BlokFiles::widget([
'items' => $items,
'options' => [
'a' => [], // or 'div' => [],
'img' => [],
'span' => []]
]);
$options = [
'url' => '/app/',
'key' => 'id', // items->id
]; // url + key
$options = [
'url' => '/app/${key}.png',
'key' => 'id', // items->id
'parse' => true,
]; // url/key.png
use denisok94\yii2\widgets\BlokFiles;
echo BlokFiles::widget([
'items' => $items,
'callback' => function ($action, $item, $key) {
return $action = 'img' ? 'url1' : 'url2';
},
]);
use denisok94\yii2\widgets\BlokFiles;
echo BlokFiles::widget([
'items' => $items,
'options' => [
'a' => [
'url' => '/app/',
'key' => 'id', // items->id
],
'img' => [
'url' => '/app/${key}.png',
'key' => 'id', // items->id
'parse' => true,
],
'span' => [
'key' => 'name', // items->name
],
]
]);