$post_ID =
$block->context
['postId'
];
// Check is needed for backward compatibility with third-party plugins
// that might rely on the `in_the_loop` check; calling `the_post` sets it to true.
if ( !
in_the_loop() &&
have_posts() ) { the_post();
} $is_link =
isset( $attributes['isLink'
] ) &&
$attributes['isLink'
];
$size_slug =
isset( $attributes['sizeSlug'
] ) ?
$attributes['sizeSlug'
] : 'post-thumbnail';
$attr =
get_block_core_post_featured_image_border_attributes( $attributes );
$overlay_markup =
get_block_core_post_featured_image_overlay_element_markup( $attributes );
if ( $is_link ) { if ( get_the_title( $post_ID ) ) { $attr['alt'
] =
trim( strip_tags( get_the_title( $post_ID ) ) );
} else { $attr['alt'
] =
sprintf( // translators: %d is the post ID.
__( 'Untitled post %d'
),
$post_ID );
} }