File "project-widget.php"
Full Path: /home/leadltht/fastlinkinternet.com/admin/wp-content/plugins/bdevs-element/widgets/project/project-widget.php
File size: 49.23 KB
MIME-type: text/x-php
Charset: utf-8
<?php
namespace BdevsElement\Widget;
use \Elementor\Utils;
use \Elementor\Repeater;
Use \Elementor\Core\Schemes\Typography;
use \Elementor\Control_Media;
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Group_Control_Typography;
defined( 'ABSPATH' ) || die();
class Project extends BDevs_El_Widget {
/**
* Get widget name.
*
* Retrieve Bdevs Element widget name.
*
* @since 1.0.0
* @access public
*
* @return string Widget name.
*/
public function get_name() {
return 'project';
}
/**
* Get widget title.
*
* @since 1.0.0
* @access public
*
* @return string Widget title.
*/
public function get_title() {
return __( 'Project', 'bdevselement' );
}
public function get_custom_help_url() {
return 'http://elementor.bdevs.net//widgets/info-box/';
}
/**
* Get widget icon.
*
* @since 1.0.0
* @access public
*
* @return string Widget icon.
*/
public function get_icon() {
return 'eicon-gallery-grid';
}
public function get_keywords() {
return [ 'info', 'project', 'box', 'text', 'content' ];
}
/**
* Register content related controls
*/
protected function register_content_controls() {
$this->start_controls_section(
'_section_design_title',
[
'label' => __( 'Design Style', 'bdevselement' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'design_style',
[
'label' => __( 'Design Style', 'bdevselement' ),
'type' => Controls_Manager::SELECT,
'options' => [
'style_1' => __( 'Style 1', 'bdevselement' ),
'style_2' => __( 'Style 2', 'bdevselement' ),
'style_3' => __( 'Style 3', 'bdevselement' ),
'style_4' => __( 'Style 4: Masonry', 'bdevselement' ),
'style_5' => __( 'Style 5: Metro', 'bdevselement' ),
],
'default' => 'style_1',
'frontend_available' => true,
'style_transfer' => true,
]
);
$this->end_controls_section();
$this->start_controls_section(
'_section_title',
[
'label' => __( 'Title & Description', 'bdevselement' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$this->add_control(
'big_title',
[
'label' => __( 'Big Title', 'bdevselement' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'default' => __( 'Project Shadow Title', 'bdevselement' ),
'placeholder' => __( 'Shadow Title', 'bdevselement' ),
'dynamic' => [
'active' => true,
]
]
);
$this->add_control(
'sub_title',
[
'label' => __( 'Sub Title', 'bdevselement' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'default' => __( 'Project Sub Title', 'bdevselement' ),
'placeholder' => __( 'Sub Title', 'bdevselement' ),
'dynamic' => [
'active' => true,
]
]
);
$this->add_control(
'title',
[
'label' => __( 'Title', 'bdevselement' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'default' => __( 'Project Box Title', 'bdevselement' ),
'placeholder' => __( 'Type Info Box Title', 'bdevselement' ),
'dynamic' => [
'active' => true,
]
]
);
$this->add_control(
'description',
[
'label' => __( 'Description', 'bdevselement' ),
'description' => bdevs_element_get_allowed_html_desc( 'intermediate' ),
'type' => Controls_Manager::TEXTAREA,
'default' => __( 'Project Box description goes here', 'bdevselement' ),
'placeholder' => __( 'Type info box description', 'bdevselement' ),
'rows' => 5,
'condition' => [
'field_condition' => ['style_30'],
],
'dynamic' => [
'active' => true,
]
]
);
$this->add_control(
'title_tag',
[
'label' => __( 'Title HTML Tag', 'bdevselement' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'h1' => [
'title' => __( 'H1', 'bdevselement' ),
'icon' => 'eicon-editor-h1'
],
'h2' => [
'title' => __( 'H2', 'bdevselement' ),
'icon' => 'eicon-editor-h2'
],
'h3' => [
'title' => __( 'H3', 'bdevselement' ),
'icon' => 'eicon-editor-h3'
],
'h4' => [
'title' => __( 'H4', 'bdevselement' ),
'icon' => 'eicon-editor-h4'
],
'h5' => [
'title' => __( 'H5', 'bdevselement' ),
'icon' => 'eicon-editor-h5'
],
'h6' => [
'title' => __( 'H6', 'bdevselement' ),
'icon' => 'eicon-editor-h6'
]
],
'default' => 'h2',
'toggle' => false,
]
);
$this->add_responsive_control(
'align',
[
'label' => __( 'Alignment', 'bdevselement' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __( 'Left', 'bdevselement' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => __( 'Center', 'bdevselement' ),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => __( 'Right', 'bdevselement' ),
'icon' => 'fa fa-align-right',
],
],
'toggle' => true,
'selectors' => [
'{{WRAPPER}}' => 'text-align: {{VALUE}};'
]
]
);
$this->end_controls_section();
$this->start_controls_section(
'_section_projects',
[
'label' => __( 'Projects List', 'bdevselement' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$repeater = new Repeater();
$repeater->add_control(
'field_condition',
[
'label' => __( 'Field condition', 'bdevselement' ),
'type' => Controls_Manager::SELECT,
'options' => [
'style_1' => __( 'Style 1', 'bdevselement' ),
'style_2' => __( 'Style 2', 'bdevselement' ),
'style_3' => __( 'Style 3', 'bdevselement' ),
'style_4' => __( 'Style 4: Masonry', 'bdevselement' ),
'style_5' => __( 'Style 5: Metro', 'bdevselement' ),
],
'default' => 'style_1',
'frontend_available' => true,
'style_transfer' => true,
]
);
$repeater->add_control(
'image',
[
'type' => Controls_Manager::MEDIA,
'label' => __( 'Image', 'bdevselement' ),
'default' => [
'url' => Utils::get_placeholder_image_src(),
],
'dynamic' => [
'active' => true,
]
]
);
$repeater->add_control(
'title',
[
'type' => Controls_Manager::TEXT,
'label_block' => true,
'label' => __( 'Title', 'bdevselement' ),
'default' => __( 'Title Here', 'bdevselement' ),
'placeholder' => __( 'Type title here', 'bdevselement' ),
'dynamic' => [
'active' => true,
]
]
);
//button two
$repeater->add_control(
'button_text',
[
'label' => __( 'Text', 'bdevselement' ),
'type' => Controls_Manager::TEXT,
'default' => 'Button Text',
'placeholder' => __( 'Type button text here', 'bdevselement' ),
'label_block' => true,
'condition' => [
'field_condition' => ['style_1','style_2','style_3'],
],
'dynamic' => [
'active' => true,
]
]
);
$repeater->add_control(
'button_link',
[
'label' => __( 'Link', 'bdevselement' ),
'type' => Controls_Manager::URL,
'placeholder' => 'http://elementor.bdevs.net/',
'condition' => [
'field_condition' => ['style_1','style_2','style_3','style_4','style_5'],
],
'dynamic' => [
'active' => true,
]
]
);
if ( bdevs_element_is_elementor_version( '<', '2.6.0' ) ) {
$repeater->add_control(
'button_icon',
[
'label' => __( 'Icon', 'bdevselement' ),
'label_block' => true,
'type' => Controls_Manager::ICON,
'options' => bdevs_element_get_bdevs_element_icons(),
'default' => 'fa fa-angle-right',
]
);
$condition = ['button_icon!' => ''];
} else {
$repeater->add_control(
'button_selected_icon',
[
'type' => Controls_Manager::ICONS,
'fa4compatibility' => 'button_icon',
'label_block' => true,
]
);
$condition = ['button_selected_icon[value]!' => ''];
}
$repeater->add_control(
'button_icon_position',
[
'label' => __( 'Icon Position', 'bdevselement' ),
'type' => Controls_Manager::CHOOSE,
'label_block' => false,
'options' => [
'before' => [
'title' => __( 'Before', 'bdevselement' ),
'icon' => 'eicon-h-align-left',
],
'after' => [
'title' => __( 'After', 'bdevselement' ),
'icon' => 'eicon-h-align-right',
],
],
'default' => 'before',
'toggle' => false,
'condition' => $condition,
'style_transfer' => true,
]
);
$repeater->add_control(
'button_icon_spacing',
[
'label' => __( 'Icon Spacing', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'condition' => $condition,
'selectors' => [
'{{WRAPPER}} .bdevs-btn--icon-before .bdevs-btn-icon' => 'margin-right: {{SIZE}}{{UNIT}};',
'{{WRAPPER}} .bdevs-btn--icon-after .bdevs-btn-icon' => 'margin-left: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'projects',
[
'show_label' => false,
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'title_field' => '<# print(title || "Carousel Item"); #>',
'default' => [
[
'image' => [
'url' => Utils::get_placeholder_image_src(),
],
],
[
'image' => [
'url' => Utils::get_placeholder_image_src(),
],
],
[
'image' => [
'url' => Utils::get_placeholder_image_src(),
],
],
[
'image' => [
'url' => Utils::get_placeholder_image_src(),
],
],
[
'image' => [
'url' => Utils::get_placeholder_image_src(),
],
]
]
]
);
$this->add_group_control(
Group_Control_Image_Size::get_type(),
[
'name' => 'thumbnail',
'default' => 'medium_large',
'separator' => 'before',
'exclude' => [
'custom'
]
]
);
$this->end_controls_section();
}
/**
* Register styles related controls
*/
protected function register_style_controls() {
$this->start_controls_section(
'_section_media_style',
[
'label' => __( 'Icon / Image', 'bdevselement' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'icon_size',
[
'label' => __( 'Size', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 10,
'max' => 300,
],
],
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-figure--icon' => 'font-size: {{SIZE}}{{UNIT}};',
],
'condition' => [
'type' => 'icon'
]
]
);
$this->add_responsive_control(
'image_width',
[
'label' => __( 'Width', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'px' => [
'min' => 1,
'max' => 400,
],
'%' => [
'min' => 1,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-figure--image' => 'width: {{SIZE}}{{UNIT}};',
],
'condition' => [
'type' => 'image'
]
]
);
$this->add_responsive_control(
'image_height',
[
'label' => __( 'Height', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 1,
'max' => 400,
],
],
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-figure--image' => 'height: {{SIZE}}{{UNIT}};',
],
'condition' => [
'type' => 'image'
]
]
);
$this->add_control(
'offset_toggle',
[
'label' => __( 'Offset', 'bdevselement' ),
'type' => Controls_Manager::POPOVER_TOGGLE,
'label_off' => __( 'None', 'bdevselement' ),
'label_on' => __( 'Custom', 'bdevselement' ),
'return_value' => 'yes',
]
);
$this->start_popover();
$this->add_responsive_control(
'media_offset_x',
[
'label' => __( 'Offset Left', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'condition' => [
'offset_toggle' => 'yes'
],
'range' => [
'px' => [
'min' => -1000,
'max' => 1000,
],
],
'render_type' => 'ui',
]
);
$this->add_responsive_control(
'media_offset_y',
[
'label' => __( 'Offset Top', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'condition' => [
'offset_toggle' => 'yes'
],
'range' => [
'px' => [
'min' => -1000,
'max' => 1000,
],
],
'selectors' => [
// Media translate styles
'(desktop){{WRAPPER}} .bdevs-infobox-figure' => '-ms-transform: translate({{media_offset_x.SIZE || 0}}{{UNIT}}, {{media_offset_y.SIZE || 0}}{{UNIT}}); -webkit-transform: translate({{media_offset_x.SIZE || 0}}{{UNIT}}, {{media_offset_y.SIZE || 0}}{{UNIT}}); transform: translate({{media_offset_x.SIZE || 0}}{{UNIT}}, {{media_offset_y.SIZE || 0}}{{UNIT}});',
'(tablet){{WRAPPER}} .bdevs-infobox-figure' => '-ms-transform: translate({{media_offset_x_tablet.SIZE || 0}}{{UNIT}}, {{media_offset_y_tablet.SIZE || 0}}{{UNIT}}); -webkit-transform: translate({{media_offset_x_tablet.SIZE || 0}}{{UNIT}}, {{media_offset_y_tablet.SIZE || 0}}{{UNIT}}); transform: translate({{media_offset_x_tablet.SIZE || 0}}{{UNIT}}, {{media_offset_y_tablet.SIZE || 0}}{{UNIT}});',
'(mobile){{WRAPPER}} .bdevs-infobox-figure' => '-ms-transform: translate({{media_offset_x_mobile.SIZE || 0}}{{UNIT}}, {{media_offset_y_mobile.SIZE || 0}}{{UNIT}}); -webkit-transform: translate({{media_offset_x_mobile.SIZE || 0}}{{UNIT}}, {{media_offset_y_mobile.SIZE || 0}}{{UNIT}}); transform: translate({{media_offset_x_mobile.SIZE || 0}}{{UNIT}}, {{media_offset_y_mobile.SIZE || 0}}{{UNIT}});',
// Body text styles
'{{WRAPPER}} .bdevs-infobox-body' => 'margin-top: {{SIZE}}{{UNIT}};',
],
]
);
$this->end_popover();
$this->add_responsive_control(
'media_spacing',
[
'label' => __( 'Bottom Spacing', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-figure' => 'margin-bottom: {{SIZE}}{{UNIT}} !important;',
],
]
);
$this->add_responsive_control(
'media_padding',
[
'label' => __( 'Padding', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-figure--image img, {{WRAPPER}} .bdevs-infobox-figure--icon' => 'padding: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'media_border',
'selector' => '{{WRAPPER}} .bdevs-infobox-figure--image img, {{WRAPPER}} .bdevs-infobox-figure--icon',
]
);
$this->add_responsive_control(
'media_border_radius',
[
'label' => __( 'Border Radius', 'bdevselement' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-figure--image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .bdevs-infobox-figure--icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'media_box_shadow',
'exclude' => [
'box_shadow_position',
],
'selector' => '{{WRAPPER}} .bdevs-infobox-figure--image img, {{WRAPPER}} .bdevs-infobox-figure--icon'
]
);
$this->add_control(
'icon_color',
[
'label' => __( 'Color', 'bdevselement' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-figure--icon' => 'color: {{VALUE}}',
],
'condition' => [
'type' => 'icon'
]
]
);
$this->add_control(
'icon_bg_color',
[
'label' => __( 'Background Color', 'bdevselement' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-figure--icon' => 'background-color: {{VALUE}};',
],
'condition' => [
'type' => 'icon'
]
]
);
$this->add_control(
'icon_bg_rotate',
[
'label' => __( 'Background Rotate', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'deg' ],
'default' => [
'unit' => 'deg',
],
'range' => [
'deg' => [
'min' => 0,
'max' => 360,
],
],
'selectors' => [
// Icon rotate styles
'{{WRAPPER}} .bdevs-infobox-figure--icon > i' => '-ms-transform: rotate(-{{SIZE}}{{UNIT}}); -webkit-transform: rotate(-{{SIZE}}{{UNIT}}); transform: rotate(-{{SIZE}}{{UNIT}});',
// Icon box transform styles
'(desktop){{WRAPPER}} .bdevs-infobox-figure--icon' => '-ms-transform: translate({{media_offset_x.SIZE || 0}}px, {{media_offset_y.SIZE || 0}}px) rotate({{SIZE}}deg); -webkit-transform: translate({{media_offset_x.SIZE || 0}}px, {{media_offset_y.SIZE || 0}}px) rotate({{SIZE}}deg); transform: translate({{media_offset_x.SIZE || 0}}px, {{media_offset_y.SIZE || 0}}px) rotate({{SIZE}}deg);',
'(tablet){{WRAPPER}} .bdevs-infobox-figure--icon' => '-ms-transform: translate({{media_offset_x_tablet.SIZE || 0}}px, {{media_offset_y_tablet.SIZE || 0}}px) rotate({{SIZE}}deg); -webkit-transform: translate({{media_offset_x_tablet.SIZE || 0}}px, {{media_offset_y_tablet.SIZE || 0}}px) rotate({{SIZE}}deg); transform: translate({{media_offset_x_tablet.SIZE || 0}}px, {{media_offset_y_tablet.SIZE || 0}}px) rotate({{SIZE}}deg);',
'(mobile){{WRAPPER}} .bdevs-infobox-figure--icon' => '-ms-transform: translate({{media_offset_x_mobile.SIZE || 0}}px, {{media_offset_y_mobile.SIZE || 0}}px) rotate({{SIZE}}deg); -webkit-transform: translate({{media_offset_x_mobile.SIZE || 0}}px, {{media_offset_y_mobile.SIZE || 0}}px) rotate({{SIZE}}deg); transform: translate({{media_offset_x_mobile.SIZE || 0}}px, {{media_offset_y_mobile.SIZE || 0}}px) rotate({{SIZE}}deg);',
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'_section_title_style',
[
'label' => __( 'Title & Description', 'bdevselement' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'content_padding',
[
'label' => __( 'Content Box Padding', 'bdevselement' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'title_heading',
[
'type' => Controls_Manager::HEADING,
'label' => __( 'Title', 'bdevselement' ),
'separator' => 'before'
]
);
$this->add_responsive_control(
'title_spacing',
[
'label' => __( 'Bottom Spacing', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'title_color',
[
'label' => __( 'Text Color', 'bdevselement' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-title' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'label' => __( 'Typography', 'bdevselement' ),
'selector' => '{{WRAPPER}} .bdevs-infobox-title',
'scheme' => Typography::TYPOGRAPHY_2
]
);
$this->add_control(
'description_heading',
[
'type' => Controls_Manager::HEADING,
'label' => __( 'Description', 'bdevselement' ),
'separator' => 'before'
]
);
$this->add_responsive_control(
'description_spacing',
[
'label' => __( 'Bottom Spacing', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-text' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_control(
'description_color',
[
'label' => __( 'Text Color', 'bdevselement' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .bdevs-infobox-text' => 'color: {{VALUE}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'description_typography',
'label' => __( 'Typography', 'bdevselement' ),
'selector' => '{{WRAPPER}} .bdevs-infobox-text',
'scheme' => Typography::TYPOGRAPHY_3,
]
);
$this->end_controls_section();
$this->start_controls_section(
'_section_style_button',
[
'label' => __( 'Button', 'bdevselement' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'link_padding',
[
'label' => __( 'Padding', 'bdevselement' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'btn_typography',
'selector' => '{{WRAPPER}} .btn',
'scheme' => Typography::TYPOGRAPHY_4,
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'button_border',
'selector' => '{{WRAPPER}} .btn',
]
);
$this->add_control(
'button_border_radius',
[
'label' => __( 'Border Radius', 'bdevselement' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'button_box_shadow',
'selector' => '{{WRAPPER}} .btn',
]
);
$this->add_control(
'hr',
[
'type' => Controls_Manager::DIVIDER,
'style' => 'thick',
]
);
$this->start_controls_tabs( '_tabs_button' );
$this->start_controls_tab(
'_tab_button_normal',
[
'label' => __( 'Normal', 'bdevselement' ),
]
);
$this->add_control(
'link_color',
[
'label' => __( 'Text Color', 'bdevselement' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .btn' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'button_bg_color',
[
'label' => __( 'Background Color', 'bdevselement' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .btn' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'button_icon_translate',
[
'label' => __( 'Icon Translate X', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => -100,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .btn--icon-before .btn-icon' => '-webkit-transform: translateX(calc(-1 * {{SIZE}}{{UNIT}})); transform: translateX(calc(-1 * {{SIZE}}{{UNIT}}));',
'{{WRAPPER}} .btn--icon-after .btn-icon' => '-webkit-transform: translateX({{SIZE}}{{UNIT}}); transform: translateX({{SIZE}}{{UNIT}});',
],
]
);
$this->end_controls_tab();
$this->start_controls_tab(
'_tab_button_hover',
[
'label' => __( 'Hover', 'bdevselement' ),
]
);
$this->add_control(
'link_hover_color',
[
'label' => __( 'Text Color', 'bdevselement' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .btn:hover, {{WRAPPER}} .btn:focus' => 'color: {{VALUE}};',
],
]
);
$this->add_control(
'button_hover_bg_color',
[
'label' => __( 'Background Color', 'bdevselement' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .btn:hover, {{WRAPPER}} .btn:focus' => 'background-color: {{VALUE}};',
],
]
);
$this->add_control(
'button_hover_border_color',
[
'label' => __( 'Border Color', 'bdevselement' ),
'type' => Controls_Manager::COLOR,
'condition' => [
'button_border_border!' => '',
],
'selectors' => [
'{{WRAPPER}} .btn:hover, {{WRAPPER}} .btn:focus' => 'border-color: {{VALUE}};',
],
]
);
$this->add_control(
'button_hover_icon_translate',
[
'label' => __( 'Icon Translate X', 'bdevselement' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 10
],
'range' => [
'px' => [
'min' => -100,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .btn.btn--icon-before:hover .btn-icon' => '-webkit-transform: translateX(calc(-1 * {{SIZE}}{{UNIT}})); transform: translateX(calc(-1 * {{SIZE}}{{UNIT}}));',
'{{WRAPPER}} .btn.btn--icon-after:hover .btn-icon' => '-webkit-transform: translateX({{SIZE}}{{UNIT}}); transform: translateX({{SIZE}}{{UNIT}});',
],
]
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
$this->add_inline_editing_attributes( 'title', 'basic' );
$this->add_render_attribute( 'title', 'class', 'big_title mb-0' );
?>
<?php if ( $settings['design_style'] === 'style_5' ):
$this->add_render_attribute( 'hyperlink', 'class', 'plus_effect' );
?>
<div class="portfolio_section sec_ptb_130 clearfix">
<div class="container">
<div class="metro_portfolio_grid grid wow fadeInUp22" data-wow-delay=".1s">
<div class="grid-sizer"></div>
<?php
$class_name = 'w_50';
foreach ( $settings['projects'] as $key => $slide ) :
if( !empty($slide['image']['id']) ) {
$image = wp_get_attachment_image_url( $slide['image']['id'], $settings['thumbnail_size'] );
}
$this->add_render_attribute( 'hyperlink', 'href', esc_url($slide['button_link']['url']), true );
?>
<div class="grid-item <?php echo ($key%4 < 2) ? $class_name : '';?>">
<div class="portfolio_fullimage">
<?php if( !empty($image) ): ?>
<a <?php $this->print_render_attribute_string( 'hyperlink' ); ?>>
<img src="<?php echo esc_url($slide['image']['url']); ?>" alt="image_not_found" />
</a>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<?php elseif ( $settings['design_style'] === 'style_4' ):
$this->add_render_attribute( 'hyperlink', 'class', 'plus_effect' ); ?>
<section class="portfolio_section sec_ptb_130 clearfix">
<?php if( !empty($settings['title']) ): ?>
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-12">
<div class="section_title text-center mb_50 wow fadeInUp22" data-wow-delay=".1s">
<?php if( !empty($settings['sub_title']) ): ?>
<h4 class="small_title"><?php echo bdevs_element_kses_intermediate( $settings['sub_title'] ); ?></h4>
<?php endif; ?>
<?php printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['title_tag'] ),
$this->get_render_attribute_string( 'title' ),
bdevs_element_kses_basic( $settings['title' ] )
); ?>
<?php if ( !empty($settings['big_title']) ) : ?>
<span class="biggest_title"><?php echo bdevs_element_kses_basic( $settings['big_title'] ); ?></span>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="container-fluid">
<div class="masonry_portfolio_grid grid wow fadeInUp22" data-wow-delay=".3s">
<div class="grid-sizer"></div>
<?php
$class_name = 'w_50';
foreach ( $settings['projects'] as $key => $slide ) :
if( !empty($slide['image']['id']) ) {
$image = wp_get_attachment_image_url( $slide['image']['id'], $settings['thumbnail_size'] );
}
$this->add_render_attribute( 'hyperlink', 'href', esc_url($slide['button_link']['url']), true );
?>
<div class="grid-item <?php echo ( ($key%6) > 3) ? $class_name : '';?>">
<div class="portfolio_fullimage">
<?php if( !empty($image) ): ?>
<a <?php $this->print_render_attribute_string( 'hyperlink' ); ?>>
<img src="<?php echo esc_url($slide['image']['url']); ?>" alt="image_not_found" />
</a>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<?php elseif ( $settings['design_style'] === 'style_3' ):
$this->add_render_attribute( 'button', 'class', 'icon_btn' ); ?>
<section class="portfolio_section sec_ptb_130 clearfix">
<div class="container">
<?php if( !empty($settings['title']) ): ?>
<div class="row justify-content-center">
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-12">
<div class="section_title text-center mb_50 wow fadeInUp22" data-wow-delay=".1s">
<?php if( !empty($settings['sub_title']) ): ?>
<h4 class="small_title"><?php echo bdevs_element_kses_intermediate( $settings['sub_title'] ); ?></h4>
<?php endif; ?>
<?php printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['title_tag'] ),
$this->get_render_attribute_string( 'title' ),
bdevs_element_kses_basic( $settings['title' ] )
); ?>
<?php if ( !empty($settings['big_title']) ) : ?>
<span class="biggest_title"><?php echo bdevs_element_kses_basic( $settings['big_title'] ); ?></span>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
<div class="portfolio_carousel w_1545 owl-carousel owl-theme wow fadeInUp22" data-wow-delay=".3s">
<?php
foreach ( $settings['projects'] as $key => $slide ) :
if( !empty($slide['image']['id']) ) {
$image = wp_get_attachment_image_url( $slide['image']['id'], $settings['thumbnail_size'] );
}
$this->add_render_attribute( 'button', 'href', esc_url($slide['button_link']['url']), true );
?>
<div class="item">
<div class="portfolio_fullimage">
<?php if( !empty($image) ): ?>
<img src="<?php echo esc_url($slide['image']['url']); ?>" alt="image_not_found" />
<?php endif; ?>
<div class="title_wrap">
<?php if( !empty($slide['title']) ): ?>
<h3 class="item_title mb-0"><?php echo bdevs_element_kses_basic( $slide['title'] ); ?></h3>
<?php endif; ?>
<?php if ( $slide['button_text'] && ( ( empty( $slide['button_selected_icon'] ) || empty( $slide['button_selected_icon']['value'] ) ) && empty( $slide['button_icon'] ) ) ) :
printf( '<a %1$s href="%3$s">%2$s</a>',
$this->get_render_attribute_string( 'button' ),
esc_html( $slide['button_text'] ),
esc_url($slide['button_link']['url'])
);
elseif ( empty( $slide['button_text'] ) && ( ( !empty( $slide['button_selected_icon'] ) || empty( $slide['button_selected_icon']['value'] ) ) || !empty( $slide['button_icon'] ) ) ) :
?>
<a <?php $this->print_render_attribute_string( 'button' ); ?>><?php bdevs_element_render_icon( $slide, 'button_icon', 'button_selected_icon' ); ?></a>
<?php elseif ( $slide['button_text'] && ( ( !empty( $slide['button_selected_icon'] ) || empty( $slide['button_selected_icon']['value'] ) ) || !empty($slide['button_icon']) ) ) :
if ( $slide['button_icon_position'] === 'before' ): ?>
<a <?php $this->print_render_attribute_string( 'button' ); ?>><span><?php bdevs_element_render_icon( $slide, 'button_icon', 'button_selected_icon', ['class' => 'bdevs-btn-icon'] ); ?></span> <?php echo esc_html($slide['button_text']); ?></a>
<?php
else: ?>
<a <?php $this->print_render_attribute_string( 'button' ); ?>><?php echo esc_html($slide['button_text']); ?> <span><?php bdevs_element_render_icon( $slide, 'button_icon', 'button_selected_icon', ['class' => 'bdevs-btn-icon'] ); ?></span></a>
<?php
endif;
endif; ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<?php elseif ( $settings['design_style'] === 'style_2' ): ?>
<section class="portfolio_section sec_ptb_130 pb-0 clearfix">
<?php if( !empty($settings['title']) ): ?>
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-12">
<div class="section_title text-center mb_50 wow fadeInUp22" data-wow-delay=".1s">
<?php if( !empty($settings['sub_title']) ): ?>
<h4 class="small_title"><?php echo bdevs_element_kses_intermediate( $settings['sub_title'] ); ?></h4>
<?php endif; ?>
<?php printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['title_tag'] ),
$this->get_render_attribute_string( 'title' ),
bdevs_element_kses_basic( $settings['title' ] )
); ?>
<?php if ( !empty($settings['big_title']) ) : ?>
<span class="biggest_title"><?php echo bdevs_element_kses_basic( $settings['big_title'] ); ?></span>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="container-fluid">
<div class="masonry_portfolio_grid grid wow fadeInUp22" data-wow-delay=".3s">
<div class="grid-sizer"></div>
<?php
$class_name = 'w_50';
foreach ( $settings['projects'] as $key => $slide ) :
$image = wp_get_attachment_image_url( $slide['image']['id'], $settings['thumbnail_size'] );
?>
<div class="grid-item <?php echo ($key > 3) ? $class_name : '';?>">
<div class="portfolio_fullimage">
<?php if( !empty($image) ): ?>
<a class="plus_effect" href="<?php echo esc_url($slide['button_link']['url']); ?>">
<img src="<?php echo esc_url($slide['image']['url']); ?>" alt="image_not_found" />
</a>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<?php else: ?>
<section class="portfolio_section sec_ptb_130 clearfix">
<div class="container">
<?php if( !empty($settings['title']) ): ?>
<div class="row justify-content-center">
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-12">
<div class="section_title text-center mb_80 wow fadeInUp22" data-wow-delay=".1s">
<?php if( !empty($settings['sub_title']) ): ?>
<h4 class="small_title"><?php echo bdevs_element_kses_intermediate( $settings['sub_title'] ); ?></h4>
<?php endif; ?>
<?php printf( '<%1$s %2$s>%3$s</%1$s>',
tag_escape( $settings['title_tag'] ),
$this->get_render_attribute_string( 'title' ),
bdevs_element_kses_basic( $settings['title' ] )
); ?>
<?php if ( !empty($settings['big_title']) ) : ?>
<span class="biggest_title"><?php echo bdevs_element_kses_basic( $settings['big_title'] ); ?></span>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
<div class="metro_portfolio_grid grid wow fadeInUp22" data-wow-delay=".3s">
<div class="grid-sizer"></div>
<?php
$class_name = 'w_50';
foreach ( $settings['projects'] as $key => $slide ) :
$image = wp_get_attachment_image_url( $slide['image']['id'], $settings['thumbnail_size'] );
?>
<div class="grid-item <?php echo ($key < 2) ? $class_name : '';?>">
<div class="portfolio_fullimage">
<?php if( !empty($image) ): ?>
<a class="plus_effect" href="<?php echo esc_url($slide['button_link']['url']); ?>">
<img src="<?php echo esc_url($slide['image']['url']); ?>" alt="image_not_found" />
</a>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<?php endif; ?>
<?php
}
}