[ 'grid', __( 'Grid', 'ai-eshop-optimizer' ) ], 'list' => [ 'list', __( 'List', 'ai-eshop-optimizer' ) ], ]; $rooster_links = ''; foreach ( $rooster_views as $rooster_view => [ $rooster_icon, $rooster_label ] ) { $rooster_links .= sprintf( '%5$s%4$s', esc_url( WooCommerce::view_url( $rooster_view ) ), esc_attr( $rooster_view ), $rooster_view === $rooster_current ? ' aria-current="true"' : '', esc_attr( $rooster_label ), rooster_icon( $rooster_icon, [ 'width' => 20, 'height' => 20 ] ) ); } $rooster_columns = array_values( array_unique( array_intersect( array_map( 'intval', (array) ( $attributes['columns'] ?? [] ) ), [ 3, 4 ] ) ) ); $rooster_phone = class_exists( Rooster\Core\DeviceClass::class ) && Rooster\Core\DeviceClass::enabled() && 'mobile' === rooster_device_class(); $rooster_cols = ''; if ( count( $rooster_columns ) > 1 && ! $rooster_phone && method_exists( WooCommerce::class, 'columns_switch' ) ) { sort( $rooster_columns ); foreach ( $rooster_columns as $rooster_count ) { $rooster_name = sprintf( _n( '%d product a row', '%d products a row', $rooster_count, 'ai-eshop-optimizer' ), $rooster_count ); $rooster_cols .= sprintf( '', $rooster_count, (string) $rooster_count === WooCommerce::shop_columns() ? 'true' : 'false', esc_attr( $rooster_name ), 'list' === $rooster_current ? ' disabled' : '' ); } $rooster_cols = sprintf( '