Make WordPress Core


Ignore:
Timestamp:
11/08/2021 02:26:27 PM (3 years ago)
Author:
youknowriad
Message:

Block Editor: Update the WordPress Packages based on Gutenberg 11.9 RC1.

This brings the JS packages up to date and is the first step that will allow us
to include the other block editor updates for WordPress 5.9:
FSE infrastrucutre, site editor and global styles.

Props noisysocks.
See #54337.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/post-terms.php

    r51362 r52042  
    2424
    2525    $post_terms = get_the_terms( $block->context['postId'], $attributes['term'] );
    26     if ( is_wp_error( $post_terms ) ) {
    27         return '';
    28     }
    29     if ( empty( $post_terms ) ) {
     26    if ( is_wp_error( $post_terms ) || empty( $post_terms ) ) {
    3027        return '';
    3128    }
    3229
    33     $align_class_name = empty( $attributes['textAlign'] ) ? '' : ' ' . "has-text-align-{$attributes['textAlign']}";
     30    $classes = 'taxonomy-' . $attributes['term'];
     31    if ( isset( $attributes['textAlign'] ) ) {
     32        $classes .= ' has-text-align-' . $attributes['textAlign'];
     33    }
    3434
    35     $terms_links = '';
    36     foreach ( $post_terms as $term ) {
    37         $terms_links .= sprintf(
    38             '<a href="%1$s">%2$s</a> | ',
    39             get_term_link( $term->term_id ),
    40             esc_html( $term->name )
    41         );
    42     }
    43     $terms_links        = trim( $terms_links, ' | ' );
    44     $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
     35    $separator = empty( $attributes['separator'] ) ? ' ' : $attributes['separator'];
    4536
    46     return sprintf(
    47         '<div %1$s>%2$s</div>',
    48         $wrapper_attributes,
    49         $terms_links
     37    $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
     38
     39    return get_the_term_list(
     40        $block->context['postId'],
     41        $attributes['term'],
     42        "<div $wrapper_attributes>",
     43        '<span class="wp-block-post-terms__separator">' . $separator . '</span>',
     44        '</div>'
    5045    );
    5146}
Note: See TracChangeset for help on using the changeset viewer.