| @@ -250,22 +250,23 @@ | ||
| 250 | 250 | return $messages; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | - * @todo Something | |
| 254 | + * Keep this source's notifications out of the popup loop in | |
| 255 | + * FrontEnd::get_notifications_ids(). They render inline at the hooks | |
| 256 | + * chosen in `inline_location`, never as a floating popup. | |
| 255 | 257 | * |
| 256 | - * @param [type] $exclude | |
| 257 | - * @param [type] $settings | |
| 258 | - * @return void | |
| 258 | + * `inline_location` is not read here on purpose: it can be saved as '' | |
| 259 | + * (MCP or Quick Builder create without the field), and passing that to | |
| 260 | + * array_diff() is a TypeError on PHP 8 that white-screens every page. | |
| 261 | + * | |
| 262 | + * @param bool $exclude Whether an earlier callback already excluded it. | |
| 263 | + * @param array $settings Notification settings. | |
| 264 | + * @return bool | |
| 259 | 265 | */ |
| 260 | 266 | public function show_on_exclude( $exclude, $settings ) { |
| 261 | - if ( $settings['source'] === $this->id ) { | |
| 262 | - $woo_location = $settings['inline_location']; | |
| 263 | - $hooks = ['woocommerce_before_add_to_cart_form', 'woocommerce_after_shop_loop_item_title', 'woocommerce_after_shop_loop_item', 'woocommerce_after_cart_item_name']; | |
| 264 | - $diff = array_diff( $hooks, $woo_location ); | |
| 265 | - if ( count( $diff ) <= count( $hooks ) ) { | |
| 266 | - return true; | |
| 267 | - } | |
| 267 | + if ( isset( $settings['source'] ) && $this->id === $settings['source'] ) { | |
| 268 | + return true; | |
| 268 | 269 | } |
| 269 | 270 | return $exclude; |
| 270 | 271 | } |
| 271 | 272 | |