get_settings(); if ( empty( $s['enabled'] ) ) { return; } add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); add_action( 'woocommerce_single_product_summary', array( $this, 'output_classic_before_title' ), 4 ); add_action( 'woocommerce_single_product_summary', array( $this, 'output_classic_under_title' ), 6 ); add_action( 'woocommerce_product_meta_end', array( $this, 'output_classic_after_post_meta' ) ); } public function output_classic_before_title() { if ( ! $this->is_active() ) { return; } $s = $this->get_settings(); if ( $s['position'] === 'before_title' ) { echo wp_kses_post( $this->get_html( 'before_title' ) ); return; } if ( $s['position'] === 'mobile_before_desktop_inline' ) { echo wp_kses_post( $this->get_html( 'mobile_only_before' ) ); } } public function output_classic_under_title() { if ( ! $this->is_active() ) { return; } $s = $this->get_settings(); if ( in_array( $s['position'], array( 'under_title', 'in_title_row', 'mobile_before_desktop_inline' ), true ) ) { echo wp_kses_post( $this->get_html() ); } } public function output_classic_after_post_meta() { if ( ! $this->is_active() ) { return; } $s = $this->get_settings(); if ( $s['position'] === 'after_post_meta' ) { echo wp_kses_post( $this->get_html() ); } } public function get_settings($raw = false) { $stored = get_option( self::OPTION_KEY, array() ); if ( ! is_array( $stored ) ) { $stored = array(); } $merged = array_merge( array( 'enabled' => false, 'mode' => 'text', 'position' => 'before_title', 'show_label' => false, 'label_text' => '', 'image_max_width' => 120, 'image_max_height' => 40, 'image_max_width_mobile' => 90, 'image_max_height_mobile' => 30, 'mobile_breakpoint' => 768, 'text_color' => '#212121', 'label_color' => '#6b7280', 'link_color' => '', 'title_bold' => true, 'font_size' => '0.92em', 'align' => 'flex-start', 'margin_top' => 10, 'margin_bottom' => 10, 'custom_class' => '', ), $stored ); if ( class_exists( 'AIEO_DMM_Product_Display' ) ) { $bz = AIEO_DMM_Product_Display::get_cluster_zones(); $bz = isset( $bz['brand_display'] ) ? (string) $bz['brand_display'] : 'info'; if ( $bz === 'beside_title' ) { $merged['position'] = 'in_title_row'; } elseif ( in_array( $merged['position'], array( 'in_title_row', 'mobile_before_desktop_inline' ), true ) ) { $merged['position'] = 'under_title'; } } return $raw ? ($merged) : self::fill_i18n_defaults($merged); } private static function i18n_labels() { return array( 'label_text' => __('Brand', 'ai-eshop-optimizer'), ); } private static function fill_i18n_defaults(array $s) { if (!did_action('init')) { return $s; } foreach (self::i18n_labels() as $k => $v) { if (!isset($s[$k]) || '' === trim((string) $s[$k])) { $s[$k] = $v; } } return $s; } public function ajax_save() { AIEO_DMM::verify_ajax_request(); update_option( self::OPTION_KEY, array( 'enabled' => ! empty( $_POST['enabled'] ), 'mode' => ( isset( $_POST['mode'] ) && in_array( sanitize_text_field( wp_unslash( $_POST['mode'] ) ), array( 'text', 'image' ), true ) ) ? sanitize_text_field( wp_unslash( $_POST['mode'] ) ) : 'text', 'position' => ( isset( $_POST['position'] ) && in_array( sanitize_text_field( wp_unslash( $_POST['position'] ) ), array( 'before_title', 'in_title_row', 'under_title', 'after_post_meta', 'mobile_before_desktop_inline' ), true ) ) ? sanitize_text_field( wp_unslash( $_POST['position'] ) ) : 'under_title', 'show_label' => ! empty( $_POST['show_label'] ), 'label_text' => isset( $_POST['label_text'] ) ? sanitize_text_field( wp_unslash( $_POST['label_text'] ) ) : '', 'image_max_width' => max( 20, min( 400, isset( $_POST['image_max_width'] ) ? (int) $_POST['image_max_width'] : 120 ) ), 'image_max_height' => max( 20, min( 400, isset( $_POST['image_max_height'] ) ? (int) $_POST['image_max_height'] : 40 ) ), 'image_max_width_mobile' => max( 20, min( 400, isset( $_POST['image_max_width_mobile'] ) ? (int) $_POST['image_max_width_mobile'] : 90 ) ), 'image_max_height_mobile' => max( 20, min( 400, isset( $_POST['image_max_height_mobile'] ) ? (int) $_POST['image_max_height_mobile'] : 30 ) ), 'mobile_breakpoint' => max( 320, min( 1280, isset( $_POST['mobile_breakpoint'] ) ? (int) $_POST['mobile_breakpoint'] : 768 ) ), 'text_color' => isset( $_POST['text_color'] ) ? ( sanitize_hex_color( wp_unslash( $_POST['text_color'] ) ) ?: '#212121' ) : '#212121', 'label_color' => isset( $_POST['label_color'] ) ? ( sanitize_hex_color( wp_unslash( $_POST['label_color'] ) ) ?: '#6b7280' ) : '#6b7280', 'link_color' => isset( $_POST['link_color'] ) ? ( sanitize_hex_color( wp_unslash( $_POST['link_color'] ) ) ?: '' ) : '', 'title_bold' => ! empty( $_POST['title_bold'] ), 'font_size' => ( isset( $_POST['font_size'] ) && preg_match( '/^[0-9]*\.?[0-9]+\s*(rem|em|px|%|vw|vh|pt)$/i', trim( (string) wp_unslash( $_POST['font_size'] ) ) ) ) ? trim( (string) wp_unslash( $_POST['font_size'] ) ) : '0.92em', 'align' => ( isset( $_POST['align'] ) && in_array( sanitize_text_field( wp_unslash( $_POST['align'] ) ), array( 'flex-start', 'center', 'flex-end' ), true ) ) ? sanitize_text_field( wp_unslash( $_POST['align'] ) ) : 'flex-start', 'margin_top' => max( 0, min( 100, isset( $_POST['margin_top'] ) ? (int) $_POST['margin_top'] : 10 ) ), 'margin_bottom' => max( 0, min( 100, isset( $_POST['margin_bottom'] ) ? (int) $_POST['margin_bottom'] : 10 ) ), 'custom_class' => isset( $_POST['custom_class'] ) ? sanitize_html_class( wp_unslash( $_POST['custom_class'] ) ) : '', ), false ); wp_send_json_success( array( 'message' => __( 'Brand Display settings saved.', 'ai-eshop-optimizer' ) ) ); } public function enqueue_styles() { if ( ! function_exists( 'is_product' ) || ! is_product() ) { return; } $s = $this->get_settings(); if ( 'after_post_meta' === $this->block_slot( $s['position'] ) ) { AIEO_DMM_Product_Meta::enqueue_table(); } $css = sprintf( '.aieo-brand-display{' . 'display:flex;' . 'align-items:center;' . 'justify-content:%1$s;' . 'gap:6px;' . 'margin:%2$dpx 0 %3$dpx;' . 'color:%4$s;' . 'font-size:%11$s;' . '}' . '.aieo-brand-display a{color:inherit;text-decoration:none;}' . '.aieo-brand-display a:hover{text-decoration:underline;}' . '.aieo-brand-display-label{color:%5$s;}' . '.aieo-brand-display--image img{' . 'display:block;' . 'width:%6$dpx;' . 'height:%7$dpx;' . 'object-fit:contain;' . 'object-position:%12$s center;' . '}' . '.aieo-brand-display--mobile-only-before{display:none;}' . '.aieo-brand-display--desktop-only-inline{display:flex;}' . '@media (max-width:%8$dpx){' . '.aieo-brand-display--image img{' . 'width:%9$dpx;' . 'height:%10$dpx;' . '}' . '.aieo-brand-display--before-title{' . 'justify-content:center;' . '}' . '.aieo-brand-display--before-title.aieo-brand-display--image img{' . 'object-position:center center;' . '}' . '.aieo-brand-display--mobile-only-before{display:flex;}' . '.aieo-brand-display--desktop-only-inline{display:none !important;}' . '}', esc_attr( $s['align'] ), (int) $s['margin_top'], (int) $s['margin_bottom'], esc_attr( $s['text_color'] ), esc_attr( $s['label_color'] ), (int) $s['image_max_width'], (int) $s['image_max_height'], (int) $s['mobile_breakpoint'], (int) $s['image_max_width_mobile'], (int) $s['image_max_height_mobile'], esc_attr( (string) $s['font_size'] ), 'flex-end' === $s['align'] ? 'right' : ( 'center' === $s['align'] ? 'center' : 'left' ) ); $css .= '.aieo-brand-display .aieo-brand-display-label{font-weight:' . ( ! empty( $s['title_bold'] ) ? '600' : '400' ) . ';}'; if ( ! empty( $s['link_color'] ) ) { $css .= '.aieo-brand-display a{color:' . esc_attr( (string) $s['link_color'] ) . ';}'; } $css .= 'html[data-rooster-design="theme"] .aieo-brand-display{color:var(--wp--preset--color--fg);}' . 'html[data-rooster-design="theme"] .aieo-brand-display a{color:inherit;}' . 'html[data-rooster-design="theme"] .aieo-brand-display .aieo-brand-display-label{color:var(--wp--preset--color--muted);}'; $css .= '.aieo-brand-display--text a{display:inline-block;padding-block:4px;margin-block:-4px;}'; $css .= 'html[data-rooster-design="theme"] .aieo-brand-display--text{margin:0;font-size:var(--wp--preset--font-size--xs);letter-spacing:var(--wp--custom--rooster--tracking--wide);text-transform:uppercase;color:var(--wp--preset--color--muted);}' . 'html[data-rooster-design="theme"] .aieo-brand-display--text.aieo-brand-display--before-title{justify-content:flex-start;align-items:flex-start;}'; $css .= 'html[data-rooster-design="theme"] .aieo-brand-display--text.aieo-brand-display--before-title > *{text-box:trim-both cap alphabetic;}' . 'html[data-rooster-design="theme"] .aieo-brand-display--text.aieo-brand-display--before-title > a{padding-block:11px;margin-block:-11px;}'; wp_register_style( 'aieo-brand-display', false, array(), defined( 'AIEO_VERSION' ) ? AIEO_VERSION : '1.0' ); wp_enqueue_style( 'aieo-brand-display' ); wp_add_inline_style( 'aieo-brand-display', $css ); } public function is_active() { $s = $this->get_settings(); return ! empty( $s['enabled'] ); } public function render_before_title() { if ( ! $this->is_active() ) { return; } $s = $this->get_settings(); if ( $this->block_slot( $s['position'] ) === 'before_title' ) { echo wp_kses_post( $this->get_html( 'before_title' ) ); return; } if ( $s['position'] === 'mobile_before_desktop_inline' ) { echo wp_kses_post( $this->get_html( 'mobile_only_before' ) ); return; } } public function render_under_title() { if ( ! $this->is_active() ) { return; } $s = $this->get_settings(); if ( $this->block_slot( $s['position'] ) !== 'under_title' ) { return; } echo wp_kses_post( $this->get_html() ); } public function render_after_post_meta() { if ( ! $this->is_active() ) { return; } $s = $this->get_settings(); if ( $this->block_slot( $s['position'] ) !== 'after_post_meta' ) { return; } echo wp_kses_post( $this->get_row_html() ); } private function get_row_html() { global $product; $product_id = ( $product && is_a( $product, 'WC_Product' ) ) ? (int) $product->get_id() : ( ( function_exists( 'is_singular' ) && is_singular( 'product' ) ) ? (int) get_the_ID() : 0 ); $brand_term = $product_id ? $this->get_brand_term( $product_id ) : null; if ( ! $brand_term ) { return ''; } $url = get_term_link( $brand_term ); if ( is_wp_error( $url ) ) { return ''; } $s = $this->get_settings(); $value = '' . esc_html( $brand_term->name ) . ''; $image = false; if ( 'image' === $s['mode'] ) { $image_id = $this->get_brand_logo_id( (int) $brand_term->term_id ); $img = $image_id > 0 ? $this->build_logo_img_html( $image_id, $brand_term, (int) $s['image_max_width'], (int) $s['image_max_height'] ) : ''; if ( '' !== $img ) { $value = '' . $img . ''; $image = true; } } $cls = 'aieo-product-meta aieo-brand-display--meta' . ( $image ? ' aieo-brand-display--image' : '' ) . ( ! empty( $s['custom_class'] ) ? ' ' . (string) $s['custom_class'] : '' ); return '
' . AIEO_DMM_Product_Meta::row_html( 'aieo-brand-display__row', (string) $s['label_text'], $value, __( 'Brand', 'ai-eshop-optimizer' ) ) . '
'; } private function block_slot( $position ) { if ( ! in_array( $position, array( 'before_title', 'under_title', 'after_post_meta' ), true ) || ! class_exists( 'AIEO_DMM_Product_Display' ) ) { return $position; } $zones = AIEO_DMM_Product_Display::get_cluster_zones(); if ( isset( $zones['brand_display'] ) && 'info' !== $zones['brand_display'] ) { return $position; } $order = array_values( (array) AIEO_DMM_Product_Display::get_layout_order() ); $brand = array_search( 'brand_display', $order, true ); if ( false === $brand ) { return $position; } $title = array_search( 'title', $order, true ); if ( false !== $title && $brand < $title ) { return 'before_title'; } foreach ( array( 'product_meta', 'product_categories' ) as $id ) { $at = array_search( $id, $order, true ); if ( false !== $at && ( ! isset( $zones[ $id ] ) || 'info' === $zones[ $id ] ) && $brand < $at ) { return 'under_title'; } } return 'after_post_meta'; } public function render_in_title_row() { if ( ! $this->is_active() ) { return; } $s = $this->get_settings(); if ( $s['position'] === 'in_title_row' ) { echo wp_kses_post( $this->get_html( 'in_title_row' ) ); return; } if ( $s['position'] === 'mobile_before_desktop_inline' ) { echo wp_kses_post( $this->get_html( 'desktop_only_inline' ) ); return; } } public function output() { if ( ! $this->is_active() ) { return; } echo wp_kses_post( $this->get_html() ); } public function shortcode_handler( $atts = array() ) { $s = $this->get_settings(); if ( empty( $s['enabled'] ) ) { return ''; } if ( ! is_singular( 'product' ) ) { if ( current_user_can( 'manage_options' ) ) { return '

' . esc_html__( 'Brand Display shortcode can only be used on single product pages.', 'ai-eshop-optimizer' ) . '

'; } return ''; } return $this->get_html(); } private function get_brand_term( $product_id ) { if ( ! $product_id ) { return null; } $detected = class_exists( 'AIEO_DMM_Brand_Discounts' ) ? AIEO_DMM_Brand_Discounts::get_brand_taxonomy() : null; $taxes = $detected ? array( $detected ) : array( 'product_brand', 'pwb-brand', 'yith_product_brand', 'product_brands', 'berocket_brand' ); foreach ( $taxes as $tax ) { if ( ! taxonomy_exists( $tax ) ) { continue; } $terms = get_the_terms( $product_id, $tax ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { return $terms[0]; } } return null; } private function get_brand_logo_id( $term_id ) { if ( ! $term_id ) { return 0; } global $wpdb; $table = $wpdb->prefix . 'aieo_dmm_brand_extras'; if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) ) === $table ) { $id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT logo_image_id FROM {$table} WHERE term_id = %d LIMIT 1", $term_id ) ); if ( $id > 0 ) { return $id; } } $wc_id = (int) get_term_meta( $term_id, 'thumbnail_id', true ); return $wc_id > 0 ? $wc_id : 0; } private function build_logo_img_html( $image_id, $brand_term, $max_w, $max_h ) { $alt = (string) $brand_term->name; $html = wp_get_attachment_image( (int) $image_id, 'medium', false, array( 'class' => 'aieo-brand-display-img', 'alt' => $alt, 'title' => $alt, 'loading' => 'lazy', 'decoding' => 'async', 'sizes' => sprintf( '%dpx', (int) $max_w ), ) ); return is_string( $html ) ? $html : ''; } private function get_html( $render_position = '' ) { global $product; $product_id = 0; if ( $product && is_a( $product, 'WC_Product' ) ) { $product_id = (int) $product->get_id(); } elseif ( function_exists( 'is_singular' ) && is_singular( 'product' ) ) { $product_id = (int) get_the_ID(); } if ( ! $product_id ) { return ''; } $brand_term = $this->get_brand_term( $product_id ); if ( ! $brand_term ) { return ''; } $url = get_term_link( $brand_term ); if ( is_wp_error( $url ) ) { return ''; } $s = $this->get_settings(); $custom_class = ! empty( $s['custom_class'] ) ? ' ' . esc_attr( $s['custom_class'] ) : ''; if ( $render_position === 'in_title_row' ) { $custom_class .= ' aieo-brand-display--in-title-row'; } elseif ( $render_position === 'before_title' ) { $custom_class .= ' aieo-brand-display--before-title'; } elseif ( $render_position === 'mobile_only_before' ) { $custom_class .= ' aieo-brand-display--before-title aieo-brand-display--mobile-only-before'; } elseif ( $render_position === 'desktop_only_inline' ) { $custom_class .= ' aieo-brand-display--in-title-row aieo-brand-display--desktop-only-inline'; } $label = ''; if ( ! empty( $s['show_label'] ) && ! empty( $s['label_text'] ) ) { $label = '' . esc_html( $s['label_text'] ) . ' '; } if ( $s['mode'] === 'image' ) { $image_id = $this->get_brand_logo_id( (int) $brand_term->term_id ); if ( $image_id > 0 ) { $img = $this->build_logo_img_html( $image_id, $brand_term, (int) $s['image_max_width'], (int) $s['image_max_height'] ); if ( $img !== '' ) { return sprintf( '
%s%s
', $custom_class, $label, esc_url( $url ), esc_attr( $brand_term->name ), $img ); } } } return sprintf( '
%s%s
', $custom_class, $label, esc_url( $url ), esc_html( $brand_term->name ) ); } public function render_subtab() { $s = $this->get_settings(); $id_of = static function ( $name ) { return 'aieo-bd-' . str_replace( '_', '-', $name ); }; $row = static function ( $name, $label, $control, $help = '' ) use ( $id_of ) { $field = array( 'id' => $id_of( $name ), 'label' => $label, 'control' => $control ); if ( '' !== $help ) { $field['help'] = $help; } return \Rooster\Admin\Ui::field_row( $field ); }; $switch = static function ( $name, $text ) use ( $s, $id_of ) { return \Rooster\Admin\Ui::toggle( $name, ! empty( $s[ $name ] ), array( 'id' => $id_of( $name ), 'hidden' => false, 'label' => $text ) ); }; $px = static function ( $name, $min, $max ) use ( $s, $id_of ) { return \Rooster\Admin\Ui::input( $name, (string) (int) $s[ $name ], array( 'id' => $id_of( $name ), 'type' => 'number', 'xs' => true, 'unit' => 'px', 'min' => $min, 'max' => $max ) ); }; $colour = static function ( $name, $fallback, $placeholder = '' ) use ( $s, $id_of ) { return \Rooster\Admin\Fields::color( $name, (string) $s[ $name ], array( 'id' => $id_of( $name ), 'default' => $fallback, 'placeholder' => $placeholder ) ); }; $radios = static function ( $name, $label, $options, $inline ) use ( $s, $id_of ) { return \Rooster\Admin\Ui::field_row( array( 'id' => $id_of( $name ), 'label' => $label, 'group' => true, 'control' => \Rooster\Admin\Ui::checks( $name, $options, array( (string) $s[ $name ] ), array( 'type' => 'radio', 'inline' => $inline ) ), ) ); }; $card = static function ( $anchor, $icon, $title, $col, $fields, $extra = array() ) { $form_id = 'aieo-card-' . $anchor . '-form'; list( $open, $close ) = AIEO_DMM_UI::card( array( 'anchor' => $anchor, 'icon' => $icon, 'title' => $title, 'col' => $col, 'footer' => class_exists( '\Rooster\Admin\States' ) ? \Rooster\Admin\States::save_button( $form_id ) : '', ) + $extra ); echo $open; echo AIEO_DMM_UI::card_form( 'aieo_dmm_brand_display_save', 'brand_display', $form_id, '
' . $fields . '
' ); echo $close; }; rooster_admin_band_open( array( 'cols' => 2 ) ); $fields = $row( 'enabled', __( 'Enable', 'ai-eshop-optimizer' ), $switch( 'enabled', __( 'Show brand on single product pages', 'ai-eshop-optimizer' ) ) ); $fields .= $radios( 'mode', __( 'Display mode', 'ai-eshop-optimizer' ), array( 'text' => __( 'Brand name (text link)', 'ai-eshop-optimizer' ), 'image' => __( 'Brand logo (image link, falls back to text if no logo)', 'ai-eshop-optimizer' ), ), false ); $fields .= $radios( 'position', __( 'Position', 'ai-eshop-optimizer' ), array( 'before_title' => __( 'Before the product title (brand right after the product gallery)', 'ai-eshop-optimizer' ), 'in_title_row' => __( 'In the title row (between title and wishlist heart, vertically centred)', 'ai-eshop-optimizer' ), 'mobile_before_desktop_inline' => __( 'Responsive — mobile: before title (under gallery); desktop: in title row', 'ai-eshop-optimizer' ), 'under_title' => __( 'Under the product title', 'ai-eshop-optimizer' ), 'after_post_meta' => __( 'After SKU + barcode (post-meta block)', 'ai-eshop-optimizer' ), ), false ); $card( 'brand-display-overview', 'tag', __( 'Brand name or logo, and position', 'ai-eshop-optimizer' ), 1, $fields, array( 'description' => __( 'Show the product brand on single product pages as either text or the brand logo image, linked to the brand archive. The brand is read from the `product_brand` taxonomy; the logo comes from the AIEO brand extras table (same source as the brand-archive hero).', 'ai-eshop-optimizer' ) ) ); $fields = $row( 'image_max_width', __( 'Desktop width', 'ai-eshop-optimizer' ), $px( 'image_max_width', 20, 400 ) ); $fields .= $row( 'image_max_height', __( 'Desktop height', 'ai-eshop-optimizer' ), $px( 'image_max_height', 20, 400 ) ); $fields .= $row( 'image_max_width_mobile', __( 'Mobile width', 'ai-eshop-optimizer' ), $px( 'image_max_width_mobile', 20, 400 ) ); $fields .= $row( 'image_max_height_mobile', __( 'Mobile height', 'ai-eshop-optimizer' ), $px( 'image_max_height_mobile', 20, 400 ) ); $fields .= $row( 'mobile_breakpoint', __( 'Mobile breakpoint', 'ai-eshop-optimizer' ), $px( 'mobile_breakpoint', 320, 1280 ), __( '(viewport below this width uses the mobile dimensions)', 'ai-eshop-optimizer' ) ); $card( 'brand-display-logo-dimensions', 'image', __( 'Logo dimensions (Brand logo mode only)', 'ai-eshop-optimizer' ), 2, $fields, array( 'description' => __( 'These exact values become the rendered width/height — Core Web Vitals friendly (zero CLS). The image is fit inside the box with object-fit:contain, so the aspect ratio is preserved.', 'ai-eshop-optimizer' ) ) ); $fields = $row( 'show_label', __( 'Show label prefix', 'ai-eshop-optimizer' ), $switch( 'show_label', __( 'Prepend a label before the brand (e.g. "Brand:")', 'ai-eshop-optimizer' ) ) ); $fields .= $row( 'label_text', __( 'Label text', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'label_text', (string) $s['label_text'], array( 'id' => $id_of( 'label_text' ), 'medium' => true ) ) ); $fields .= $row( 'align', __( 'Alignment', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::select( 'align', array( 'flex-start' => __( 'Left', 'ai-eshop-optimizer' ), 'center' => __( 'Center', 'ai-eshop-optimizer' ), 'flex-end' => __( 'Right', 'ai-eshop-optimizer' ) ), (string) $s['align'], array( 'id' => $id_of( 'align' ), 'short' => true ) ) ); $fields .= $row( 'text_color', __( 'Brand text colour', 'ai-eshop-optimizer' ), $colour( 'text_color', '#212121' ) ); $fields .= $row( 'label_color', __( 'Label colour', 'ai-eshop-optimizer' ), $colour( 'label_color', '#6b7280' ) ); $fields .= $row( 'link_color', __( 'Link colour', 'ai-eshop-optimizer' ), $colour( 'link_color', (string) $s['text_color'], '#0073aa' ), __( 'Colour of the brand link. Leave blank to inherit the brand text colour.', 'ai-eshop-optimizer' ) ); $fields .= $row( 'title_bold', __( 'Bold the title', 'ai-eshop-optimizer' ), $switch( 'title_bold', __( 'Render the label (when shown) in bold', 'ai-eshop-optimizer' ) ) ); $fields .= $row( 'font_size', __( 'Font size (text mode)', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'font_size', (string) $s['font_size'], array( 'id' => $id_of( 'font_size' ), 'short' => true, 'placeholder' => '0.92em' ) ), __( 'CSS size, e.g. 0.92em or 13px. Match Categories / SKU for a consistent info column.', 'ai-eshop-optimizer' ) ); $fields .= $row( 'margin_top', __( 'Margin top', 'ai-eshop-optimizer' ), $px( 'margin_top', 0, 100 ) ); $fields .= $row( 'margin_bottom', __( 'Margin bottom', 'ai-eshop-optimizer' ), $px( 'margin_bottom', 0, 100 ) ); $fields .= $row( 'custom_class', __( 'Custom CSS class', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'custom_class', (string) $s['custom_class'], array( 'id' => $id_of( 'custom_class' ), 'medium' => true, 'code' => true ) ) ); $card( 'brand-display-appearance', 'palette', __( 'Appearance', 'ai-eshop-optimizer' ), 1, $fields, array( 'description' => __( 'Set how the brand looks on the product page: an optional label before it, alignment, colours, text size, spacing and a CSS class.', 'ai-eshop-optimizer' ) ) ); rooster_admin_band_close(); } }