start_controls_section( 'content_section', [ 'label' => __('Content', 'cannaiq-menus'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'limit', [ 'label' => __('Number of Brands', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 12, 'min' => 1, 'max' => 100, ] ); $this->add_control( 'columns', [ 'label' => __('Columns', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => '4', 'options' => [ '2' => __('2 Columns', 'cannaiq-menus'), '3' => __('3 Columns', 'cannaiq-menus'), '4' => __('4 Columns', 'cannaiq-menus'), '6' => __('6 Columns', 'cannaiq-menus'), ], ] ); $this->add_control( 'show_product_count', [ 'label' => __('Show Product Count', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => __('Yes', 'cannaiq-menus'), 'label_off' => __('No', 'cannaiq-menus'), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'link_to_products', [ 'label' => __('Link to Products Page', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::URL, 'placeholder' => __('/products', 'cannaiq-menus'), 'description' => __('Brand name will be appended as ?brand=Name', 'cannaiq-menus'), ] ); $this->end_controls_section(); // Style Section $this->start_controls_section( 'style_section', [ 'label' => __('Style', 'cannaiq-menus'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'card_background', [ 'label' => __('Card Background', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .cannaiq-brand-card' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'card_border_radius', [ 'label' => __('Border Radius', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => ['px'], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'default' => [ 'size' => 8, ], 'selectors' => [ '{{WRAPPER}} .cannaiq-brand-card' => 'border-radius: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'text_color', [ 'label' => __('Text Color', 'cannaiq-menus'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#333333', 'selectors' => [ '{{WRAPPER}} .cannaiq-brand-card' => 'color: {{VALUE}};', ], ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); $plugin = CannaIQ_Menus_Plugin::instance(); $brands = $plugin->fetch_brands(['limit' => $settings['limit']]); if (!$brands) { echo '

' . __('No brands found.', 'cannaiq-menus') . '

'; return; } $columns = $settings['columns']; $link_base = $settings['link_to_products']['url'] ?? ''; ?>
onclick="window.location.href=''" style="cursor: ;">

0): ?>