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 +21 -7 1.7.2 → 1.8.16 View file →
@@ -129,9 +129,21 @@
129 129 * @since 1.16.10 (J) - 1.6.10 (WP)
130 130 */
131 131 public function preflight()
132 132 {
133 - return true;
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);
134 146 }
135 147
136 148 /**
137 149 * Returns the admin-widget priority for a custom ordering.
@@ -244,9 +256,9 @@
244 256 * Extending classes needing to periodically watch for new events and capable
245 257 * of emitting browser notifications, can override this method. The last data
246 258 * to watch should be returned during the preloading. To be used with list().
247 259 *
248 - * @param VBONotificationWatchdata $watch_data the preloaded watch-data object.
260 + * @param ?VBONotificationWatchdata $watch_data the preloaded watch-data object.
249 261 *
250 262 * @return array data object to watch next and notifications array.
251 263 *
252 264 * @see preload()
@@ -252,9 +264,9 @@
252 264 * @see preload()
253 265 *
254 266 * @since 1.15.0 (J) - 1.5.0 (WP)
255 267 */
256 - public function getNotifications(VBONotificationWatchdata $watch_data = null)
268 + public function getNotifications(?VBONotificationWatchdata $watch_data = null)
257 269 {
258 270 $watch_next = null;
259 271 $notifications = null;
260 272
@@ -265,9 +277,9 @@
265 277 * Default method to return a list of browser events to dispatch.
266 278 * Extending classes needing to periodically watch for new events
267 279 * and capable of emitting browser events, can override this method.
268 280 *
269 - * @param VBONotificationWatchdata $watch_data the preloaded watch-data object.
281 + * @param ?VBONotificationWatchdata $watch_data the preloaded watch-data object.
270 282 *
271 283 * @return array list of browser events to emit.
272 284 *
273 285 * @see preload()
@@ -273,9 +285,9 @@
273 285 * @see preload()
274 286 *
275 287 * @since 1.16.8 (J) - 1.6.8 (WP)
276 288 */
277 - public function getNotificationEvents(VBONotificationWatchdata $watch_data = null)
289 + public function getNotificationEvents(?VBONotificationWatchdata $watch_data = null)
278 290 {
279 291 return [];
280 292 }
281 293
@@ -365,8 +377,10 @@
365 377 }
366 378
367 379 /**
368 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.
369 383 *
370 384 * @return array
371 385 *
372 386 * @since 1.16.7 (J) - 1.6.7 (WP)
@@ -385,13 +399,13 @@
385 399 /**
386 400 * Extending Classes should define this method to render the actual
387 401 * output of the admin widget. Multitask data can be passed along.
388 402 *
389 - * @param VBOMultitaskData $data optional multitask data object.
403 + * @param ?VBOMultitaskData $data optional multitask data object.
390 404 *
391 405 * @since 1.15.0 (J) - 1.5.0 (WP) type hint added for $data argument.
392 406 */
393 - abstract public function render(VBOMultitaskData $data = null);
407 + abstract public function render(?VBOMultitaskData $data = null);
394 408
395 409 /**
396 410 * Returns the default icon for a widget.
397 411 *