diff --git a/lib/compat/wordpress-6.8/block-bindings/site.php b/lib/compat/wordpress-6.8/block-bindings/site.php index fe3282fc2c758d..2636027976b8fc 100644 --- a/lib/compat/wordpress-6.8/block-bindings/site.php +++ b/lib/compat/wordpress-6.8/block-bindings/site.php @@ -1,49 +1,55 @@ "foo" ). - * @param WP_Block $block_instance The block instance. - * @return mixed The value computed for the source. - */ -function _block_bindings_site_get_value( array $source_args, $block_instance ) { - if ( empty( $source_args['key'] ) ) { + +if ( ! function_exists( '_block_bindings_site_get_value' ) ) { + /** + * Gets value for Site source. + * + * @since 6.8.0 + * @access private + * + * @param array $source_args Array containing source arguments used to look up the override value. + * Example: array( "key" => "foo" ). + * @param WP_Block $block_instance The block instance. + * @return mixed The value computed for the source. + */ + function _block_bindings_site_get_value( array $source_args ) { + if ( empty( $source_args['key'] ) ) { + return null; + } + + if ( 'title' === $source_args['key'] ) { + return esc_html( get_bloginfo( 'name' ) ); + } + return null; } +} - if ( $source_args['key'] === 'title' ) { - return esc_html( get_bloginfo( 'name' ) ); + +if ( ! function_exists( '_register_block_bindings_site_source' ) ) { + /** + * Registers Site source in the block bindings registry. + * + * @since 6.8.0 + * @access private + */ + function _register_block_bindings_site_source() { + register_block_bindings_source( + 'core/site', + array( + 'label' => _x( 'Site', 'block bindings source' ), + 'get_value_callback' => '_block_bindings_site_get_value', + ) + ); } - return null; + add_action( 'init', '_register_block_bindings_site_source' ); } - -/** - * Registers Post Meta source in the block bindings registry. - * - * @since 6.5.0 - * @access private - */ -function _register_block_bindings_site_source() { - register_block_bindings_source( - 'core/site', - array( - 'label' => _x( 'Site', 'block bindings source' ), - 'get_value_callback' => '_block_bindings_site_get_value', - ) - ); -} - -add_action( 'init', '_register_block_bindings_site_source' ); diff --git a/packages/block-library/src/site-title/index.php b/packages/block-library/src/site-title/index.php index 38742d154f33b9..f36dc6bb51eb69 100644 --- a/packages/block-library/src/site-title/index.php +++ b/packages/block-library/src/site-title/index.php @@ -15,13 +15,13 @@ * @return string The render. */ function render_block_core_site_title( $attributes ) { - if ( ! isset( $attributes['content'] ) ) { + if ( ! isset( $attributes['content'] ) ) { return; } $site_title = $attributes['content']; - $tag_name = 'h1'; - $classes = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}"; + $tag_name = 'h1'; + $classes = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}"; if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) { $classes .= ' has-link-color'; }