File: /home/frenchy/refonte2023/wordpress/wp-content/plugins/ova-team/elementor/widgets/ova_team_grid.php
<?php
namespace ova_team_elementor\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Border;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class ova_team_grid extends Widget_Base {
public function get_name() {
return 'ova_team_grid';
}
public function get_title() {
return esc_html__( 'Our Team Grid', 'ova-team' );
}
public function get_icon() {
return 'eicon-posts-grid';
}
public function get_categories() {
return [ 'ovatheme_team' ];
}
public function get_script_depends() {
return [ '' ];
}
protected function register_controls() {
$this->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'ova-team' ),
]
);
$this->add_control(
'columns',
[
'label' => esc_html__( 'Columns', 'ova-team' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'three_column',
'options' => [
'two_column' => esc_html__( '2 Columns', 'ova-team' ),
'three_column' => esc_html__( '3 Columns', 'ova-team' ),
'four_column' => esc_html__( '4 Columns', 'ova-team' ),
],
]
);
$args = array(
'taxonomy' => 'cat_team',
'orderby' => 'name',
'order' => 'ASC'
);
$categories = get_categories($args);
$cate_array = array( 'all' => esc_html__('All categories', 'ova-team' ) );
if ($categories) {
foreach ( $categories as $cate ) {
$cate_array[$cate->slug] = $cate->cat_name;
}
}
$this->add_control(
'category',
[
'label' => esc_html__( 'Category', 'ova-team' ),
'type' => Controls_Manager::SELECT,
'default' => 'all',
'options' => $cate_array,
]
);
$this->add_control(
'total_count',
[
'label' => esc_html__( 'Total', 'ova-team' ),
'type' => Controls_Manager::NUMBER,
'default' => 6
]
);
$this->add_control(
'orderby_post',
[
'label' => __( 'OrderBy Post', 'ova-team' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'ID',
'options' => [
'ID' => esc_html__( 'ID', 'ova-team' ),
'date' => esc_html__( 'Date', 'ova-team' ),
'title' => esc_html__( 'Title', 'ova-team' ),
'rand' => esc_html__( 'Random', 'ova-team' ),
'ova_team_met_order_team' => esc_html__( 'Custom Order', 'ova-team' ),
],
]
);
$this->add_control(
'order_post',
[
'label' => esc_html__( 'Order', 'ova-team' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'DESC',
'options' => [
'ASC' => esc_html__( 'Ascending', 'ova-team' ),
'DESC' => esc_html__( 'Descending', 'ova-team' ),
],
]
);
$this->end_controls_section();
/* Items */
$this->start_controls_section(
'item_style_section',
[
'label' => esc_html__( 'Items', 'ova-team' ),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'item_padding',
[
'label' => esc_html__( 'Padding', 'ova-team' ),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .archive_team .items' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'item_border_width',
[
'label' => esc_html__( 'Border Width', 'ova-team' ),
'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 10,
'step' => 1,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .archive_team .items' => 'border-width: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'item_border_color',
[
'label' => esc_html__( 'Border Color', 'ova-team' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .archive_team .items' => 'border-image-source: linear-gradient(to bottom, {{VALUE}}, rgba(0, 0, 0, 0));',
],
]
);
$this->add_control(
'item_bg_color',
[
'label' => esc_html__( 'Background', 'ova-team' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .archive_team .items' => 'background: {{VALUE}};',
],
]
);
$this->end_controls_section();
/* Job */
$this->start_controls_section(
'job_style_section',
[
'label' => esc_html__( 'Job', 'ova-team' ),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'job_margin',
[
'label' => esc_html__( 'Margin', 'ova-team' ),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .archive_team .job' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'job_padding',
[
'label' => esc_html__( 'Padding', 'ova-team' ),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .archive_team .job' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'job_typography',
'selector' => '{{WRAPPER}} .archive_team .job',
]
);
$this->add_control(
'job_color',
[
'label' => esc_html__( 'Color', 'ova-team' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .archive_team .job' => 'color: {{VALUE}}',
],
]
);
$this->end_controls_section();
/* Name */
$this->start_controls_section(
'name_style_section',
[
'label' => esc_html__( 'Name', 'ova-team' ),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'name_margin',
[
'label' => esc_html__( 'Margin', 'ova-team' ),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .archive_team .name' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'name_padding',
[
'label' => esc_html__( 'Padding', 'ova-team' ),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .archive_team .name' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'name_typography',
'selector' => '{{WRAPPER}} .archive_team .name a',
]
);
$this->start_controls_tabs(
'name_style_tabs'
);
$this->start_controls_tab(
'name_style_normal_tab',
[
'label' => esc_html__( 'Normal', 'ova-team' ),
]
);
$this->add_control(
'name_color',
[
'label' => esc_html__( 'Color', 'ova-team' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .archive_team .name a' => 'color: {{VALUE}}',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'name_style_hover_tab',
[
'label' => esc_html__( 'Hover', 'ova-team' ),
]
);
$this->add_control(
'name_hover_color',
[
'label' => esc_html__( 'Color', 'ova-team' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .archive_team .name a:hover' => 'color: {{VALUE}}',
'{{WRAPPER}} .archive_team .name a:after' => 'background: {{VALUE}}',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
/* Social Icons */
$this->start_controls_section(
'icon_style_section',
[
'label' => esc_html__( 'Social Icons', 'ova-team' ),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'icon_width',
[
'label' => esc_html__( 'Width', 'ova-team' ),
'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 80,
'step' => 5,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .archive_team .ova-social .icon' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'icon_size',
[
'label' => esc_html__( 'Size', 'ova-team' ),
'type' => \Elementor\Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'range' => [
'px' => [
'min' => 0,
'max' => 50,
'step' => 5,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .archive_team .ova-social i' => 'font-size: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_responsive_control(
'icon_border_radius',
[
'label' => esc_html__( 'Border Radius', 'ova-team' ),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
'selectors' => [
'{{WRAPPER}} .archive_team .ova-social .icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->start_controls_tabs(
'icon_style_tabs'
);
$this->start_controls_tab(
'icon_style_normal_tab',
[
'label' => esc_html__( 'Normal', 'ova-team' ),
]
);
$this->add_control(
'icon_color',
[
'label' => esc_html__( 'Color', 'ova-team' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .archive_team .ova-social a' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'icon_bg',
[
'label' => esc_html__( 'Background', 'ova-team' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .archive_team .ova-social a' => 'background: {{VALUE}}',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'icon_style_hover_tab',
[
'label' => esc_html__( 'Hover', 'ova-team' ),
]
);
$this->add_control(
'icon_hover_color',
[
'label' => esc_html__( 'Color', 'ova-team' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .archive_team .ova-social a:hover' => 'color: {{VALUE}}',
],
]
);
$this->add_control(
'icon_bg_hover',
[
'label' => esc_html__( 'Background', 'ova-team' ),
'type' => \Elementor\Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .archive_team .ova-social a:hover' => 'background: {{VALUE}}',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings();
$template = apply_filters( 'el_elementor_ova_team_grid', 'elementor/ova_team_grid.php' );
ob_start();
ovateam_get_template( $template, $settings );
echo ob_get_clean();
}
}