getAttribute( 'class' ) ); if ( ! in_array( 'wp-block-heading', $classes, true ) ) { $classes[] = 'wp-block-heading'; } $styles = css_string_to_array( $heading->getAttribute( 'style' ) ); $gap = $block['attrs']['style']['spacing']['blockGap'] ?? null; if ( $gap ) { $styles['gap'] = format_custom_property( $gap ); } $styles = add_shorthand_property( $styles, 'margin', $block['attrs']['style']['spacing']['margin'] ?? [] ); $heading->setAttribute( 'class', implode( ' ', $classes ) ); $heading->setAttribute( 'style', css_array_to_string( $styles ) ); $id = $heading->getAttribute( 'id' ); if ( ! $id ) { $heading->setAttribute( 'id', remove_non_alphanumeric( sanitize_title_with_dashes( $heading->textContent ) ) ); } if ( ! $heading->getAttribute( 'style' ) ) { $heading->removeAttribute( 'style' ); } $search_query = get_search_query(); if ( $level === 1 && $search_query && $heading->textContent === __( 'Search Results', 'blockify' ) ) { $heading->textContent = sprintf( __( 'Search results for: ', 'blockify' ) . '%s', $search_query ); } return $dom->saveHTML(); }