layouts ) ) { $this->layouts = array( 'none' => array( 'label' => __( 'No Sidebar', 'accepta' ), 'image' => 'no-sidebar.svg', ), 'left' => array( 'label' => __( 'Left Sidebar', 'accepta' ), 'image' => 'left-sidebar.svg', ), 'right' => array( 'label' => __( 'Right Sidebar', 'accepta' ), 'image' => 'right-sidebar.svg', ), ); } } /** * Enqueue control related scripts/styles */ public function enqueue() { wp_enqueue_script( 'accepta-layout-control', get_template_directory_uri() . '/inc/customizer-controls/js/layout-control.js', array( 'jquery', 'customize-base' ), wp_get_theme()->get( 'Version' ), true ); wp_enqueue_style( 'accepta-layout-control', get_template_directory_uri() . '/inc/customizer-controls/css/layout-control.css', array(), wp_get_theme()->get( 'Version' ) ); } /** * Render the control's content */ public function render_content() { $input_id = '_customize-input-' . $this->id; $description_id = '_customize-description-' . $this->id; $describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '"' : ''; $value = $this->value(); ?>
label ) ) : ?> label ); ?> description ) ) : ?> description; ?>
layouts as $layout_key => $layout_data ) : ?>
link(); ?> value="" />
id ) && $this->id === 'accepta_hero_width' ) { $hero_width_svg = $this->get_hero_width_svg( $layout ); return $hero_width_svg; } // Check if this is a header width control if ( isset( $this->id ) && $this->id === 'accepta_header_width' ) { $header_width_svg = $this->get_header_width_svg( $layout ); return $header_width_svg; } // Check if this is a header layout control if ( isset( $this->id ) && $this->id === 'accepta_header_layout' ) { $header_svg = $this->get_header_layout_svg( $layout ); return $header_svg; } // Check if this is a footer columns control // Footer columns use numeric keys (0-4), sidebar layouts use text keys (none, left, right) $is_footer_columns = false; // Check control ID first (most reliable) if ( isset( $this->id ) && $this->id === 'accepta_footer_columns' ) { $is_footer_columns = true; } // Fallback: check if layout key is numeric and in footer columns range elseif ( is_numeric( $layout ) && in_array( (string) $layout, array( '0', '1', '2', '3', '4' ), true ) ) { $is_footer_columns = true; } if ( $is_footer_columns ) { $footer_svg = $this->get_footer_column_svg( (string) $layout ); return $footer_svg; } // Default to sidebar layout SVGs switch ( $layout ) { case 'none': $svg_content = ' '; break; case 'left': $svg_content = ' '; break; case 'right': $svg_content = ' '; break; } return $svg_content; } /** * Get SVG for footer column layout * * @param string $columns Number of columns (0, 1, 2, 3, 4) * @return string SVG markup */ private function get_footer_column_svg( $columns ) { $svg_content = ''; switch ( $columns ) { case '0': $svg_content = ' No Columns '; break; case '1': $svg_content = ' '; break; case '2': $svg_content = ' '; break; case '3': $svg_content = ' '; break; case '4': $svg_content = ' '; break; default: // Fallback: return empty SVG if layout doesn't match $svg_content = ''; break; } return $svg_content; } /** * Get SVG for header layout * * @param string $layout Layout key (layout-1, layout-2, layout-3, layout-4) * @return string SVG markup */ private function get_header_layout_svg( $layout ) { $svg_content = ''; switch ( $layout ) { case 'layout-1': // Layout 1: Default - LOGO | Menu | Social | Search (space-between) $svg_content = ' LOGO Default '; break; case 'layout-2': // Layout 2: Menu near logo - LOGO Menu | Social | Search $svg_content = ' LOGO Menu Left '; break; case 'layout-3': // Layout 3: Menu centered - LOGO | Menu (center) | Social | Search $svg_content = ' LOGO Menu Center '; break; default: $svg_content = ''; break; } return $svg_content; } /** * Get SVG for hero width layout * * @param string $width Width key (boxed, fullwidth) * @return string SVG markup */ private function get_hero_width_svg( $width ) { $svg_content = ''; switch ( $width ) { case 'boxed': $svg_content = ' Boxed '; break; case 'fullwidth': $svg_content = ' Full Width '; break; } return $svg_content; } /** * Get SVG for header width layout * * @param string $width Width key (boxed, fullwidth) * @return string SVG markup */ private function get_header_width_svg( $width ) { $svg_content = ''; switch ( $width ) { case 'boxed': $svg_content = ' LOGO Boxed '; break; case 'fullwidth': $svg_content = ' LOGO Full Width '; break; } return $svg_content; } }