get_block_core_avatar_border_attributes example

/** * Renders the `core/avatar` block on the server. * * @param array $attributes Block attributes. * @param string $content Block default content. * @param WP_Block $block Block instance. * @return string Return the avatar. */
function render_block_core_avatar( $attributes$content$block ) {
    $size               = isset( $attributes['size'] ) ? $attributes['size'] : 96;
    $wrapper_attributes = get_block_wrapper_attributes();
    $border_attributes  = get_block_core_avatar_border_attributes( $attributes );

    // Class gets passed through `esc_attr` via `get_avatar`.     $image_classes = ! empty( $border_attributes['class'] )
        ? "wp-block-avatar__image {$border_attributes['class']}"
        : 'wp-block-avatar__image';

    // Unlike class, `get_avatar` doesn't filter the styles via `esc_attr`.     // The style engine does pass the border styles through     // `safecss_filter_attr` however.     $image_styles = ! empty( $border_attributes['style'] )
        ? sprintf( ' style="%s"', esc_attr( $border_attributes['style'] ) )
        :
Home | Imprint | This part of the site doesn't use cookies.