🐞 fix: Migrate blocks to use helper function for wrapper classes
This commit is contained in:
@@ -15,14 +15,7 @@ $accItems = get_field( 'accordion_items' );
|
||||
|
||||
if ( $accItems ) :
|
||||
$classes = 'accordion';
|
||||
|
||||
if ( ! $is_preview ) {
|
||||
$wrapper = get_block_wrapper_attributes(
|
||||
array( 'class' => $classes )
|
||||
);
|
||||
} else {
|
||||
$wrapper = 'class="' . $classes . '"';
|
||||
}
|
||||
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||
?>
|
||||
|
||||
<section <?php echo wp_kses_post( $wrapper ); ?>>
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
{
|
||||
"name": "acf/boilerplate",
|
||||
"title": "Block Boilerplate",
|
||||
"description": "Boilerplate code to create ACF blocks.",
|
||||
"style": [
|
||||
"file:./boiilerplate.css"
|
||||
],
|
||||
"category": "vdi-block",
|
||||
"icon": "block-default",
|
||||
"keywords": [
|
||||
"boilerplate"
|
||||
],
|
||||
"acf": {
|
||||
"mode": "preview",
|
||||
"renderTemplate": "boilerplate.php"
|
||||
},
|
||||
"supports": {
|
||||
"align": false,
|
||||
"anchor": false,
|
||||
"color": false,
|
||||
"html": false,
|
||||
"jsx": false,
|
||||
"mode": false,
|
||||
"multiple": false
|
||||
}
|
||||
"name": "acf/boilerplate",
|
||||
"title": "Block Boilerplate",
|
||||
"description": "Boilerplate code to create ACF blocks.",
|
||||
"style": [
|
||||
"file:./boilerplate.css"
|
||||
],
|
||||
"category": "vdi-block",
|
||||
"icon": "block-default",
|
||||
"keywords": [
|
||||
"boilerplate"
|
||||
],
|
||||
"acf": {
|
||||
"mode": "preview",
|
||||
"renderTemplate": "boilerplate.php"
|
||||
},
|
||||
"supports": {
|
||||
"align": false,
|
||||
"anchor": false,
|
||||
"color": false,
|
||||
"html": false,
|
||||
"jsx": false,
|
||||
"mode": true,
|
||||
"multiple": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,16 +10,7 @@
|
||||
namespace BasicWP;
|
||||
|
||||
$classes = 'boilerplate';
|
||||
|
||||
if ( ! $is_preview ) {
|
||||
$wrapper = get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => $classes,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$wrapper = 'class="' . $classes . '"';
|
||||
}
|
||||
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||
?>
|
||||
|
||||
<section <?php echo esc_attr( $wrapper ); ?>>
|
||||
|
||||
@@ -12,14 +12,7 @@ namespace BasicWP;
|
||||
$ibClasses = 'flex flex-wrap gap-4 w-full justify-center sm:justify-start';
|
||||
|
||||
$classes = 'align-with-content my-[1.2em]';
|
||||
|
||||
if ( ! $is_preview ) {
|
||||
$wrapper = get_block_wrapper_attributes(
|
||||
array( 'class' => $classes )
|
||||
);
|
||||
} else {
|
||||
$wrapper = 'class="' . $classes . '"';
|
||||
}
|
||||
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||
?>
|
||||
|
||||
<div id="<?php echo esc_attr( $block['id'] ); ?>" <?php echo esc_attr( $wrapper ); ?>>
|
||||
|
||||
@@ -10,16 +10,7 @@
|
||||
namespace BasicWP;
|
||||
|
||||
$classes = 'contact-info';
|
||||
|
||||
if ( ! $is_preview ) {
|
||||
$wrapper = get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => $classes,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$wrapper = 'class="' . $classes . '"';
|
||||
}
|
||||
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||
?>
|
||||
|
||||
<section <?php echo esc_attr( $wrapper ); ?>>
|
||||
|
||||
@@ -13,16 +13,7 @@ $intro = get_field( 'intro' );
|
||||
$ctas = get_field( 'calls_to_action' );
|
||||
|
||||
$classes = 'homepage-hero mx-break-out bg-black bg-cover bg-no-repeat text-light py-12 lg:py-16 overflow-hidden';
|
||||
|
||||
if ( ! $is_preview ) {
|
||||
$wrapper = get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => $classes,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$wrapper = 'class="' . $classes . '"';
|
||||
}
|
||||
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||
?>
|
||||
|
||||
<section <?php echo wp_kses_post( $wrapper ); ?>>
|
||||
|
||||
@@ -30,11 +30,7 @@ if ( $isDark ) {
|
||||
}
|
||||
|
||||
// Set wrapper attributes
|
||||
if ( ! $is_preview ) {
|
||||
$wrapper = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
||||
} else {
|
||||
$wrapper = 'class="' . $classes . '"';
|
||||
}
|
||||
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||
|
||||
// if the video block contains an iframe, add the role="presentation" attribute
|
||||
if ( $vidBlock && strpos( $vidBlock, '<iframe' ) !== false ) {
|
||||
|
||||
@@ -34,11 +34,7 @@ if ( $isDark ) {
|
||||
}
|
||||
|
||||
// Set wrapper attributes
|
||||
if ( ! $is_preview ) {
|
||||
$wrapper = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
||||
} else {
|
||||
$wrapper = 'class="' . $classes . '"';
|
||||
}
|
||||
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||
|
||||
// if the video block contains an iframe, add the role="presentation" attribute
|
||||
if ( $vidBlock && strpos( $vidBlock, '<iframe' ) !== false ) {
|
||||
|
||||
@@ -31,11 +31,7 @@ $children = get_posts(
|
||||
$classes = 'page-children container relative px-4 py-8 mx-auto sm:px-6 sm:py-12 lg:px-8';
|
||||
|
||||
// Set wrapper attributes
|
||||
if ( ! $is_preview ) {
|
||||
$wrapper = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
||||
} else {
|
||||
$wrapper = 'class="' . $classes . '"';
|
||||
}
|
||||
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||
?>
|
||||
|
||||
<?php if ( ! empty( $children ) ) : ?>
|
||||
|
||||
@@ -64,11 +64,7 @@ if ( $ovlImage ) {
|
||||
$overlayStyles .= " opacity: $ovlOpacity;";
|
||||
|
||||
// Set wrapper attributes
|
||||
if ( ! $is_preview ) {
|
||||
$wrapper = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
||||
} else {
|
||||
$wrapper = 'class="' . $classes . '"';
|
||||
}
|
||||
$wrapper = blockWrapperAttributes( $classes, $is_preview );
|
||||
?>
|
||||
|
||||
<section <?php echo wp_kses_post( $wrapper ); ?> style="<?php echo esc_attr( $styles ); ?>">
|
||||
|
||||
Reference in New Issue
Block a user