wp/wp-includes/blocks/home-link.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   135  *
   135  *
   136  * @return string Returns the post content with the home url added.
   136  * @return string Returns the post content with the home url added.
   137  */
   137  */
   138 function render_block_core_home_link( $attributes, $content, $block ) {
   138 function render_block_core_home_link( $attributes, $content, $block ) {
   139 	if ( empty( $attributes['label'] ) ) {
   139 	if ( empty( $attributes['label'] ) ) {
   140 		// Using a fallback for the label attribute allows rendering the block even if no attributes have been set,
       
   141 		// e.g. when using the block as a hooked block.
       
   142 		// Note that the fallback value needs to be kept in sync with the one set in `edit.js` (upon first loading the block in the editor).
       
   143 		$attributes['label'] = __( 'Home' );
   140 		$attributes['label'] = __( 'Home' );
   144 	}
   141 	}
   145 	$aria_current = '';
   142 	$aria_current = '';
   146 
   143 
   147 	if ( is_front_page() ) {
   144 	if ( is_front_page() ) {