Initial commit to github

This commit is contained in:
Keith Solomon
2025-08-22 15:40:01 -05:00
commit e8efdbeb34
230 changed files with 32213 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
{
"name": "acf/media-text-innerblocks",
"title": "Media with Text Block - InnerBlocks Variant",
"description": "2 column content with image and optional calls-to-action",
"style": [
"file:./media-text-innerblocks.css"
],
"category": "vdi-block",
"icon": "screenoptions",
"keywords": [
"media",
"media-text",
"image",
"video",
"text",
"columns"
],
"acf": {
"mode": "preview",
"renderTemplate": "media-text-innerblocks.php"
},
"supports": {
"align": true,
"anchor": true,
"color": true,
"html": true,
"jsx": true,
"mode": true,
"multiple": true
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* Block Name: Media Text Inner Blocks
*
* This is the template that displays the media text inner blocks.
*
* @package BasicWP
*/
namespace BasicWP;
// Retrieve ACF fields
$bgColor = get_field( 'background_color' ) ? get_field( 'background_color' ) : '#c5c5c5';
$isDark = get_field( 'is_dark' ) ? get_field( 'is_dark' ) : false;
$mediaLeft = get_field( 'media_on_left' ) ? get_field( 'media_on_left' ) : false;
$vidBlock = get_field( 'video' ) ? get_field( 'video' ) : '';
$imgBlock = get_field( 'image' ) ? get_field( 'image' ) : array(
'url' => '',
'alt' => '',
);
// Set classes and styles
$style = "background-color: $bgColor;";
$clsMedia = $mediaLeft ? 'order-first' : 'order-last';
$clsContent = $mediaLeft ? 'order-last pr-8' : 'order-first pl-8';
$classes = 'media-cols grid grid-cols-1 lg:grid-cols-2 gap-8 items-center mb-8 p-0';
if ( $isDark ) {
$classes .= ' dark text-light';
}
// Set wrapper attributes
if ( ! $is_preview ) {
$wrapper = get_block_wrapper_attributes( array( 'class' => $classes ) );
} else {
$wrapper = 'class="' . $classes . '"';
}
// if the video block contains an iframe, add the role="presentation" attribute
if ( $vidBlock && strpos( $vidBlock, '<iframe' ) !== false ) {
$vidBlock = str_replace( '<iframe', '<iframe role="presentation"', $vidBlock );
}
?>
<div <?php echo wp_kses_post( $wrapper ); ?> style="<?php echo esc_attr( $style ); ?>">
<div class="<?php echo esc_attr( $mediaClass ); ?> <?php echo $vidBlock ? 'aspect-video' : ''; ?>">
<?php if ( $vidBlock ) : ?>
<?php echo wp_kses( $vidBlock, escEmbeds() ); ?>
<?php else : ?>
<img src="<?php echo esc_url( $imgBlock['url'] ); ?>" alt="<?php echo esc_attr( $imgBlock['alt'] ); ?>" class="">
<?php endif; ?>
</div>
<div class="content-wrapper text-balance <?php echo esc_attr( $contentClass ); ?>">
<InnerBlocks />
</div>
</div>