-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSortWidget.php
executable file
·46 lines (35 loc) · 932 Bytes
/
SortWidget.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
# @Copyright 2017 Rafal Marguzewicz pceuropa.net
namespace pceuropa\sort;
use Yii;
class SortWidget extends \yii\base\Widget{
public $config = [];
public $image_url = '';
public $controller = 'document.URL';
public $data;
public function init(){
parent::init();
if ($this->image_url === null){
$this->image_url = '/images/';
}
if ($this->data === null){
$this->data = [
['id' => 1, 'image_name' => 'no data'],
['id' => 2, 'image_name' => 'default data']
];
}
if ($this->controller === null && $this->controller === ''){
$this->controller = 'document.URL';
}
$this->config = [
'image_url' => $this->image_url,
'controller' => $this->controller,
];
}
public function run(){
return $this->renderWidget();
}
public function renderWidget(){
return $this->render('sort' , ['items' => $this->data, 'config' => $this->config]);
}
}