get_list(); $items = is_array( $list ) && ! empty( $list['items'] ) ? array_slice( $list['items'], 0, self::MAX_ITEMS ) : []; if ( empty( $items ) ) { // Cold cache is a normal state, not a failure — say nothing alarming. printf( '

%s

', esc_html__( 'Templately designs will appear here once your library has synced.', 'templately' ) ); $this->render_library_link(); return; } echo ''; $this->render_library_link(); } private function render_library_link(): void { printf( '

%2$s

', esc_url( $this->library_url( 'section' ) ), esc_html__( 'Browse the Templately library', 'templately' ) ); } /** * Deep link into the SPA. The route string must match a path the app * actually registers (Constitution VIII, cross-module route contract) — * `?page=templately&path=/gutenberg/{type}` is that scheme. */ private function library_url( string $kind ): string { $type = 'page' === $kind ? 'pages' : 'blocks'; return add_query_arg( [ 'page' => 'templately', 'path' => "/gutenberg/{$type}", ], admin_url( 'admin.php' ) ); } }