1 | <?php |
||
17 | class ToolbarBehavior extends Behavior |
||
18 | { |
||
19 | /** |
||
20 | * @var array $buttons the buttons that would be rendered within the toolbar. The buttons configuration are exactly the |
||
21 | * same as http://www.yiiframework.com/doc-2.0/yii-bootstrap-buttongroup.html to display them with one difference, |
||
22 | * multiple button groups can be displayed by providing a separator element: |
||
23 | * |
||
24 | * ``` |
||
25 | * 'buttons' => [ |
||
26 | * ['label' => 'A'], |
||
27 | * ['label' => 'B', 'visible' => false], |
||
28 | * '-', // divider |
||
29 | * ['label' => 'C'], // this will belong to a different group |
||
30 | * ] |
||
31 | * ``` |
||
32 | * @see http://www.yiiframework.com/doc-2.0/yii-bootstrap-buttongroup.html#$buttons-detail |
||
33 | */ |
||
34 | public $buttons = []; |
||
35 | /** |
||
36 | * @var boolean whether to HTML-encode the button labels of the button groups. |
||
37 | */ |
||
38 | public $encodeLabels = true; |
||
39 | /** |
||
40 | * @var array $buttonGroupOptions the options to pass to the button groups. Currently are global. For example: |
||
41 | * |
||
42 | * ``` |
||
43 | * 'buttonGroupOptions' => ['class' => 'btn-group-lg'] |
||
44 | * ``` |
||
45 | */ |
||
46 | public $buttonGroupOptions = []; |
||
47 | /** |
||
48 | * @var array the options for the toolbar tag. |
||
49 | */ |
||
50 | public $options = []; |
||
51 | /** |
||
52 | * @var array the options for the toolbar container. |
||
53 | */ |
||
54 | public $containerOptions = []; |
||
55 | /** |
||
56 | * @var string toolbar alignment, defaults to right alignment. |
||
57 | */ |
||
58 | public $alignRight = true; |
||
59 | /** |
||
60 | * @var array contains the grouped buttons |
||
61 | */ |
||
62 | protected $groups = []; |
||
63 | |||
64 | /** |
||
65 | * @inheritdoc |
||
66 | */ |
||
67 | public function init() |
||
72 | |||
73 | /** |
||
74 | * Renders the toolbar. |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | public function renderToolbar() |
||
99 | |||
100 | /** |
||
101 | * Initializes toolbar options |
||
102 | */ |
||
103 | protected function initOptions() |
||
110 | |||
111 | /** |
||
112 | * Parses the buttons to check for possible button group separations. |
||
113 | */ |
||
114 | protected function initButtonGroups() |
||
129 | } |
||
130 |