PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | admin/helpers/admin_widget.php +44 -6 1.6.8 → 1.8.16 View file →
@@ -121,8 +121,44 @@
121 121 $this->options = VBOMultitaskOptions::getInstance();
122 122 }
123 123
124 124 /**
125 + * Tells if the admin-widget can be installed on the current environment.
126 + *
127 + * @return bool
128 + *
129 + * @since 1.16.10 (J) - 1.6.10 (WP)
130 + */
131 + public function preflight()
132 + {
133 + /**
134 + * Trigger event to let external plugins to choose whether this widget should be supported or not.
135 + *
136 + * @param string $widgetId The widget identifier.
137 + *
138 + * @return bool False to drop support to this widget.
139 + *
140 + * @since 1.18 (J) - 1.8 (WP)
141 + */
142 + $results = VBOFactory::getPlatform()->getDispatcher()->filter('onPreflightAdminWidget', [$this->widgetId]);
143 +
144 + // supported only in case none of the plugins attached to this event returned FALSE
145 + return !in_array(false, $results, true);
146 + }
147 +
148 + /**
149 + * Returns the admin-widget priority for a custom ordering.
150 + *
151 + * @return int
152 + *
153 + * @since 1.16.10 (J) - 1.6.10 (WP)
154 + */
155 + public function getPriority()
156 + {
157 + return 10;
158 + }
159 +
160 + /**
125 161 * Gets the name of the current widget.
126 162 *
127 163 * @return string the widget name.
128 164 */
@@ -220,9 +256,9 @@
220 256 * Extending classes needing to periodically watch for new events and capable
221 257 * of emitting browser notifications, can override this method. The last data
222 258 * to watch should be returned during the preloading. To be used with list().
223 259 *
224 - * @param VBONotificationWatchdata $watch_data the preloaded watch-data object.
260 + * @param ?VBONotificationWatchdata $watch_data the preloaded watch-data object.
225 261 *
226 262 * @return array data object to watch next and notifications array.
227 263 *
228 264 * @see preload()
@@ -228,9 +264,9 @@
228 264 * @see preload()
229 265 *
230 266 * @since 1.15.0 (J) - 1.5.0 (WP)
231 267 */
232 - public function getNotifications(VBONotificationWatchdata $watch_data = null)
268 + public function getNotifications(?VBONotificationWatchdata $watch_data = null)
233 269 {
234 270 $watch_next = null;
235 271 $notifications = null;
236 272
@@ -241,9 +277,9 @@
241 277 * Default method to return a list of browser events to dispatch.
242 278 * Extending classes needing to periodically watch for new events
243 279 * and capable of emitting browser events, can override this method.
244 280 *
245 - * @param VBONotificationWatchdata $watch_data the preloaded watch-data object.
281 + * @param ?VBONotificationWatchdata $watch_data the preloaded watch-data object.
246 282 *
247 283 * @return array list of browser events to emit.
248 284 *
249 285 * @see preload()
@@ -249,9 +285,9 @@
249 285 * @see preload()
250 286 *
251 287 * @since 1.16.8 (J) - 1.6.8 (WP)
252 288 */
253 - public function getNotificationEvents(VBONotificationWatchdata $watch_data = null)
289 + public function getNotificationEvents(?VBONotificationWatchdata $watch_data = null)
254 290 {
255 291 return [];
256 292 }
257 293
@@ -341,8 +377,10 @@
341 377 }
342 378
343 379 /**
344 380 * Returns an associative array with the current widget details.
381 + * Method's visibility should never change from public, because
382 + * the controller may call it, and widgets may override it.
345 383 *
346 384 * @return array
347 385 *
348 386 * @since 1.16.7 (J) - 1.6.7 (WP)
@@ -361,13 +399,13 @@
361 399 /**
362 400 * Extending Classes should define this method to render the actual
363 401 * output of the admin widget. Multitask data can be passed along.
364 402 *
365 - * @param VBOMultitaskData $data optional multitask data object.
403 + * @param ?VBOMultitaskData $data optional multitask data object.
366 404 *
367 405 * @since 1.15.0 (J) - 1.5.0 (WP) type hint added for $data argument.
368 406 */
369 - abstract public function render(VBOMultitaskData $data = null);
407 + abstract public function render(?VBOMultitaskData $data = null);
370 408
371 409 /**
372 410 * Returns the default icon for a widget.
373 411 *