Create custom widget in Yii2
In this example We am creating a dropdown widget. This is only provide a basic structure of how to create your own custom widget.
Following files you need to create for widget.
1. _template.php
print_r($model);
die;
2.GridviewDropdown.php
namespace common\widgets\dropdownWidget;3.viewFile.php
use yii\base\Widget;
public function init(){
parent::init(); } public function run(){ return $this->render('_template', ['items' => $this->data]);
}
}
echo \common\widgets\dropdownWidget\GridviewDropdown::widget([
'model' => $model
])
It is nice post and I found some interesting information on this blog, keep it up. Thanks for sharing. Dedicated Yii Framework Developers in India
ReplyDelete