1 | <?php |
||
9 | class WidgetHelper |
||
|
|||
10 | { |
||
11 | private $container; |
||
12 | |||
13 | public function __construct(Container $container) |
||
17 | |||
18 | /** |
||
19 | * The name of the widget. |
||
20 | * |
||
21 | * @return string |
||
22 | */ |
||
23 | public function getWidgetName(Widget $widget) |
||
34 | |||
35 | /** |
||
36 | * check if widget is allowed for slot. |
||
37 | * |
||
38 | * @param Widget $widget |
||
39 | * @param string $slot |
||
40 | * |
||
41 | * @return bool |
||
42 | */ |
||
43 | public function isWidgetAllowedForSlot(Widget $widget, $slot) |
||
50 | |||
51 | /** |
||
52 | * create a new WidgetRedactor. |
||
53 | * |
||
54 | * @param string $type |
||
55 | * @param string $mode |
||
56 | * |
||
57 | * @return Widget $widget |
||
58 | */ |
||
59 | public function newWidgetInstance($type, $mode) |
||
68 | |||
69 | /** |
||
70 | * Get the name of the template to display for an action. |
||
71 | * |
||
72 | * @param string $action |
||
73 | * @param Widget $widget |
||
74 | * |
||
75 | * @todo find a better way to get the requested template |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getTemplateName($action, Widget $widget) |
||
86 | |||
87 | /** |
||
88 | * Delete manually a widget with its id. |
||
89 | * |
||
90 | * @param int $widgetId |
||
91 | * |
||
92 | * @return string |
||
93 | */ |
||
94 | public function deleteById($widgetId) |
||
102 | |||
103 | /** |
||
104 | * Check in the driver chain if the given widget is enabled. |
||
105 | * |
||
106 | * @param Widget $widget |
||
107 | * |
||
108 | * @return bool |
||
109 | */ |
||
110 | public function isEnabled(Widget $widget) |
||
121 | |||
122 | /** |
||
123 | * Check in the driver chain if the given widget is enabled. |
||
124 | * |
||
125 | * @param Widget $widget |
||
126 | * |
||
127 | * @return bool |
||
128 | */ |
||
129 | public function isCacheEnabled(Widget $widget) |
||
144 | |||
145 | /** |
||
146 | * Check in the driver chain if the given widget is enabled. |
||
147 | * |
||
148 | * @param Widget $widget |
||
149 | * |
||
150 | * @return bool |
||
151 | */ |
||
152 | public function getCacheTimeout(Widget $widget) |
||
167 | } |
||
168 |