1 | <?php |
||
15 | class SocialLikes extends \yii\base\Widget |
||
16 | { |
||
17 | const THEME_FLAT = 'flat'; |
||
18 | const THEME_LIGHT = 'light'; |
||
19 | const THEME_BIRMAN = 'birman'; |
||
20 | |||
21 | /** |
||
22 | * Theme buttons |
||
23 | * @var string flat, light, birman |
||
24 | */ |
||
25 | public $theme = 'flat'; |
||
26 | |||
27 | /** |
||
28 | * Display name of social networks, default true |
||
29 | * @var bool |
||
30 | */ |
||
31 | public $title = true; |
||
32 | |||
33 | /** |
||
34 | * @var array |
||
35 | */ |
||
36 | public $items = []; |
||
37 | |||
38 | /** |
||
39 | * @var array |
||
40 | */ |
||
41 | public $containerOptions = []; |
||
42 | |||
43 | /** |
||
44 | * @var array |
||
45 | */ |
||
46 | public $clientOptions = []; |
||
47 | |||
48 | /** |
||
49 | * @var array |
||
50 | */ |
||
51 | public $clientButtons = []; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | public $clientCss = ''; |
||
57 | |||
58 | /** |
||
59 | * @var string |
||
60 | */ |
||
61 | public $id; |
||
62 | |||
63 | /** |
||
64 | * Initializes the widget |
||
65 | */ |
||
66 | 2 | public function init() |
|
79 | |||
80 | /** |
||
81 | * Run widget |
||
82 | * @return string|void |
||
83 | */ |
||
84 | 1 | public function run() |
|
92 | |||
93 | /** |
||
94 | * Render items |
||
95 | * @param array $items |
||
96 | */ |
||
97 | 1 | public function renderItems($items = []) |
|
104 | |||
105 | /** |
||
106 | * @param array $options |
||
107 | * @return bool|mixed |
||
108 | */ |
||
109 | 1 | protected function getContentTitle($options = []) |
|
113 | |||
114 | /** |
||
115 | * Register client assets |
||
116 | */ |
||
117 | 2 | protected function registerAssets() |
|
125 | |||
126 | /** |
||
127 | * @param null|\yii\web\View $view |
||
128 | */ |
||
129 | 2 | protected function registerClientCss($view = null) |
|
135 | |||
136 | /** |
||
137 | * @param null|\yii\web\View $view |
||
138 | */ |
||
139 | 2 | protected function registerClientButton($view = null) |
|
149 | |||
150 | /** |
||
151 | * @param null|\yii\web\View $view |
||
152 | */ |
||
153 | 2 | protected function registerClientOptions($view = null) |
|
165 | } |
||
166 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: