attributes['displayPreview'] ) ) { return $block_content; } $processor = new WP_HTML_Tag_Processor( $block_content ); $processor->next_tag(); $processor->set_attribute( 'data-wp-island', '' ); $processor->next_tag( 'object' ); $processor->set_attribute( 'data-wp-bind.hidden', '!selectors.core.file.hasPdfPreview' ); $processor->set_attribute( 'hidden', true ); return $processor->get_updated_html(); } add_filter( 'render_block_core/file', 'gutenberg_block_core_file_add_directives_to_content', 10, 3 ); /** * Add Interactivity API directives to the navigation block markup using the Tag Processor * The final HTML of the navigation block will look similar to this: * * * * @param string $block_content Markup of the navigation block. * * @return string Navigation block markup with the proper directives */ function gutenberg_block_core_navigation_add_directives_to_markup( $block_content ) { $w = new WP_HTML_Tag_Processor( $block_content ); // Add directives to the `