<?php

if ( ! defined( 'ABSPATH' ) ) { return; }
if ( ! function_exists( 'is_singular' ) || ! is_singular( 'product' ) ) { return; }
if ( ! class_exists( 'AIEO_DMM_Product_Meta' ) ) { return; }

$pm_zone = isset( $attributes['zone'] ) ? sanitize_key( (string) $attributes['zone'] ) : '';
if ( $pm_zone === 'info' || $pm_zone === 'under' ) {
    $pm_zones    = get_option( 'aieo_dmm_product_display_zones', array() );
    $pm_assigned = ( is_array( $pm_zones ) && isset( $pm_zones['product_meta'] ) && $pm_zones['product_meta'] === 'under' ) ? 'under' : 'info';
    if ( $pm_zone !== $pm_assigned ) { return; }
}

$module = new AIEO_DMM_Product_Meta();
$inner  = (string) $module->render_for_block();

if ( trim( $inner ) === '' ) { return; }

$wrapper_attrs = function_exists( 'get_block_wrapper_attributes' )
    ? get_block_wrapper_attributes( array( 'class' => 'aieo-product-meta-block' ) )
    : 'class="aieo-product-meta-block"';

echo '<div ' . $wrapper_attrs . '>' . $inner . '</div>'; 
