$aieo_cd_id( $name ), 'label' => $label, 'control' => $control );
if ( '' !== $help ) {
$row['help'] = $help;
}
return \Rooster\Admin\Ui::field_row( $row );
};
$aieo_cd_px = static function ( $name, $min, $max ) use ( $appearance, $aieo_cd_id ) {
return \Rooster\Admin\Ui::input( $name, (string) (int) $appearance[ $name ], array( 'id' => $aieo_cd_id( $name ), 'type' => 'number', 'xs' => true, 'unit' => 'px', 'min' => $min, 'max' => $max ) );
};
$aieo_cd_colour = static function ( $name ) use ( $appearance, $aieo_cd_id ) {
return \Rooster\Admin\Fields::color( $name, AIEO_DMM_Complementary::picked( $name, (string) $appearance[ $name ] ), array( 'id' => $aieo_cd_id( $name ), 'default' => '' ) );
};
$aieo_cd_card = static function ( $anchor, $icon, $title, $description, $fields ) use ( $aieo_cd_save ) {
list( $open, $close ) = AIEO_DMM_UI::card(
array(
'anchor' => $anchor,
'footer' => $aieo_cd_save( $anchor ),
'icon' => $icon,
'title' => $title,
'description' => $description,
)
);
echo $open;
echo AIEO_DMM_UI::card_form( 'aieo_dmm_complementary_save_appearance', 'complementary_display', 'aieo-card-' . $anchor . '-form', '
' . $fields . '
' );
echo $close;
};
if ( function_exists( 'rooster_admin_band_open' ) ) {
rooster_admin_band_open( array( 'cols' => 2 ) );
}
$aieo_cd_fields = $aieo_cd_row( 'title_size', __( 'Title size', 'ai-eshop-optimizer' ), $aieo_cd_px( 'title_size', 8, 48 ) );
$aieo_cd_fields .= $aieo_cd_row( 'text_size', __( 'Body text size', 'ai-eshop-optimizer' ), $aieo_cd_px( 'text_size', 8, 32 ), __( 'Drives product name, price, and button text size.', 'ai-eshop-optimizer' ) );
$aieo_cd_fields .= $aieo_cd_row( 'bg_color', __( 'Background color', 'ai-eshop-optimizer' ), $aieo_cd_colour( 'bg_color' ) );
$aieo_cd_fields .= $aieo_cd_row( 'border_color', __( 'Border color', 'ai-eshop-optimizer' ), $aieo_cd_colour( 'border_color' ) );
$aieo_cd_fields .= $aieo_cd_row( 'border_width', __( 'Border thickness', 'ai-eshop-optimizer' ), $aieo_cd_px( 'border_width', 0, 10 ) );
$aieo_cd_fields .= $aieo_cd_row( 'border_radius', __( 'Border radius', 'ai-eshop-optimizer' ), $aieo_cd_px( 'border_radius', 0, 40 ) );
$aieo_cd_card(
'complementary-display-card',
'layout-grid',
__( 'Card', 'ai-eshop-optimizer' ),
__( 'Style the "Complete your purchase with…" picker block on single product pages. These values apply globally to every complementary set; per-source title text + button labels stay on the data-side page.', 'ai-eshop-optimizer' ),
$aieo_cd_fields
);
$aieo_cd_fields = $aieo_cd_row( 'btn_bg_color', __( 'Background color', 'ai-eshop-optimizer' ), $aieo_cd_colour( 'btn_bg_color' ) );
$aieo_cd_fields .= $aieo_cd_row( 'btn_text_color', __( 'Text color', 'ai-eshop-optimizer' ), $aieo_cd_colour( 'btn_text_color' ) );
$aieo_cd_fields .= $aieo_cd_row( 'btn_border_color', __( 'Border color', 'ai-eshop-optimizer' ), $aieo_cd_colour( 'btn_border_color' ) );
$aieo_cd_fields .= $aieo_cd_row( 'btn_border_width', __( 'Border thickness', 'ai-eshop-optimizer' ), $aieo_cd_px( 'btn_border_width', 0, 10 ) );
$aieo_cd_fields .= $aieo_cd_row( 'btn_border_radius', __( 'Border radius', 'ai-eshop-optimizer' ), $aieo_cd_px( 'btn_border_radius', 0, 40 ) );
$aieo_cd_card(
'complementary-display-add-selected-to-cart-button',
'shopping-cart',
__( '"Add selected" button', 'ai-eshop-optimizer' ),
__( 'Sets the colours, border thickness and corner radius of the button that adds every ticked complementary product to the cart in one click.', 'ai-eshop-optimizer' ),
$aieo_cd_fields
);
if ( function_exists( 'rooster_admin_band_close' ) ) {
rooster_admin_band_close();
}