XylotrechusZ
<?php
namespace ElementorWpbingo\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
if ( ! defined( 'ABSPATH' ) ) exit;
class Bwp_Brand extends Widget_Base {
public function get_name() {
return 'bwp_brand';
}
public function get_title() {
return __( 'Wpbingo Brand', 'wpbingo' );
}
public function get_icon() {
return 'eicon-image-hotspot';
}
public function get_categories() {
return [ 'general' ];
}
protected function register_controls() {
$terms = get_terms( 'product_brand', array( 'parent' => '', 'hide_empty' => 0 ) );
$term = array();
if( count( $terms ) > 0 ){
foreach( $terms as $cat ){
$term[$cat->slug] = $cat -> name;
}
}
$number = array('1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7);
$this->start_controls_section(
'content_section',
[
'label' => __( 'Content', 'wpbingo' ),
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'title1',
[
'label' => __( 'Title', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => '',
'placeholder' => __( 'Type your title here', 'wpbingo' ),
]
);
$this->add_control(
'class',
[
'label' => __( 'Extra Class', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::TEXT,
'default' => '',
'placeholder' => __( 'Type your Extra Class here', 'wpbingo' ),
]
);
$this->add_control(
'category',
[
'label' => __( 'Brands', 'wpbingo' ),
'multiple' => true,
'type' => \Elementor\Controls_Manager::SELECT2,
'default' => array(),
'options' => $term,
]
);
$this->add_control(
'item_row',
[
'label' => __( 'Number row per column', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => array('1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5),
'default' => 1
]
);
$this->add_control(
'columns',
[
'label' => __( 'Number of Columns >1440px', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => $number,
'default' => 1
]
);
$this->add_control(
'columns1440',
[
'label' => __( 'Number of Columns 1200px to 1440px', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => $number,
'default' => 1
]
);
$this->add_control(
'columns1',
[
'label' => __( 'Number of Columns on 992px to 1199px', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => $number,
'default' => 1
]
);
$this->add_control(
'columns2',
[
'label' => __( 'Number of Columns on 768px to 991px', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => $number,
'default' => 1
]
);
$this->add_control(
'columns3',
[
'label' => __( 'Number of Columns on 480px to 767px', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => $number,
'default' => 1
]
);
$this->add_control(
'columns4',
[
'label' => __( 'Number of Columns in 480px or less than', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => '',
'options' => $number,
'default' => 1
]
);
$this->add_control(
'show_nav',
[
'label' => __( 'Show Navigation', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => [
'1' => __( 'Yes', 'wpbingo' ),
'0' => __( 'No', 'wpbingo' ),
],
'default' => '0'
]
);
$this->add_control(
'layout',
[
'label' => __( 'Layout', 'wpbingo' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'default',
'options' => [
'default' => __( 'Default', 'wpbingo' ),
'default2' => __( 'Default 2', 'wpbingo' ),
'layout2' => __( 'Layout Style', 'wpbingo' ),
'layout3' => __( 'Layout Style 3', 'wpbingo' )
],
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
extract( shortcode_atts(
array(
'title1' => '',
'class' => '',
'category' => 0,
'orderby' => 'name',
'order' => 'DESC',
'item_row'=> 1,
'columns' => 4,
'columns1440' => 4,
'columns1' => 4,
'columns2' => 3,
'columns3' => 2,
'columns4' => 1,
'show_nav' => '0',
'layout' => 'default'
), $settings )
);
include( WPBINGO_ELEMENTOR_TEMPLATE_PATH.'bwp-brand/default.php' );
}
}