Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Results Count block render.
4 *
5 * @package automattic/jetpack-search
6 */
7
8namespace Automattic\Jetpack\Search;
9
10if ( ! defined( 'ABSPATH' ) ) {
11    exit( 0 );
12}
13
14?>
15<?php
16// Intentionally render the element even when the count text is empty. The
17// Blog Search Page pattern places results-count and results-sort in a flex
18// group with `justifyContent: space-between`; removing the element from the
19// flow when there are no results would collapse that layout, snapping the
20// sort control to the left. An always-present (but text-empty) paragraph
21// keeps the two controls at the outer edges of the row.
22//
23// Pre-hydration text: `state.resultsCountText` is seeded with the localized
24// "Searching…" string when the URL is going to trigger an initial fetch
25// (see `Search_Blocks::build_initial_state()`), and the IA SSR pass writes
26// that string into the body via `data-wp-text` â€” so a deep link no longer
27// flashes a blank line before JS hydrates.
28?>
29<p
30    <?php echo wp_kses_data( get_block_wrapper_attributes() ); ?>
31    data-wp-interactive="jetpack-search"
32    data-wp-text="state.resultsCountText"
33></p>