🐞 fix: Migrate blocks to use helper function for wrapper classes

This commit is contained in:
Keith Solomon
2025-11-20 10:20:29 -06:00
parent 974cb70b5e
commit 38ec5f850d
11 changed files with 53 additions and 90 deletions

View File

@@ -31,6 +31,26 @@ function getFieldValue( $field_path ) {
return $field;
}
/**
* Returns wrapper attributes for a block for both preview and front-end contexts.
*
* @param string $classes Space separated class list.
* @param bool $is_preview Whether the block is being previewed in the editor.
*
* @return string Wrapper attributes ready for output.
*/
function blockWrapperAttributes( $classes, $is_preview ) {
if ( $is_preview ) {
return 'class="' . $classes . '"';
}
return get_block_wrapper_attributes(
array(
'class' => $classes,
)
);
}
// Add Global Fields options page.
if ( function_exists( 'acf_add_options_page' ) ) {
add_action(