<?php
/**
* Class: Jet_Elements_Banner
* Name: Banner
* Slug: jet-banner
*/
namespace Elementor;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Repeater;
use Elementor\Scheme_Color;
use Elementor\Scheme_Typography;
use Elementor\Widget_Base;
use Elementor\Utils;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Jet_Elements_Banner extends Jet_Elements_Base {
public function get_name() {
return 'jet-banner';
}
public function get_title() {
return esc_html__( 'Banner', 'jet-elements' );
}
public function get_icon() {
return 'jet-elements-icon-banner';
}
public function get_jet_help_url() {
return 'https://crocoblock.com/knowledge-base/articles/jetelements-banner-widget-how-to-add-animated-banners-to-pages-built-with-elementor/';
}
public function get_categories() {
return array( 'cherry' );
}
protected function _register_controls() {
$this->start_controls_section(
'section_content',
array(
'label' => esc_html__( 'Content', 'jet-elements' ),
)
);
$this->add_control(
'banner_image',
array(
'label' => esc_html__( 'Image', 'jet-elements' ),
'type' => Controls_Manager::MEDIA,
'default' => array(
'url' => Utils::get_placeholder_image_src(),
),
'dynamic' => array( 'active' => true ),
)
);
$this->add_control(
'banner_image_size',
array(
'type' => 'select',
'label' => esc_html__( 'Image Size', 'jet-elements' ),
'default' => 'full',
'options' => jet_elements_tools()->get_image_sizes(),
)
);
$this->add_control(
'banner_title',
array(
'label' => esc_html__( 'Title', 'jet-elements' ),
'type' => Controls_Manager::TEXT,
'dynamic' => array( 'active' => true ),
)
);
$this->add_control(
'banner_title_html_tag',
array(
'label' => esc_html__( 'Title HTML Tag', 'jet-elements' ),
'type' => Controls_Manager::SELECT,
'options' => jet_elements_tools()->get_available_title_html_tags(),
'default' => 'h5',
)
);
$this->add_control(
'banner_text',
array(
'label' => esc_html__( 'Description', 'jet-elements' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => array( 'active' => true ),
)
);
$this->add_control(
'banner_link',
array(
'label' => esc_html__( 'Link', 'jet-elements' ),
'type' => Controls_Manager::TEXT,
'dynamic' => array(
'active' => true,
'categories' => array(
TagsModule::POST_META_CATEGORY,
TagsModule::URL_CATEGORY,
),
),
)
);
$this->add_control(
'banner_link_target',
array(
'label' => esc_html__( 'Open link in new window', 'jet-elements' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => '_blank',
'condition' => array(
'banner_link!' => '',
),
)
);
$this->add_control(
'banner_link_rel',
array(
'label' => esc_html__( 'Add nofollow', 'jet-elements' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'nofollow',
'condition' => array(
'banner_link!' => '',
),
)
);
$this->end_controls_section();
$this->start_controls_section(
'section_settings',
array(
'label' => esc_html__( 'Settings', 'jet-elements' ),
)
);
$this->add_control(
'animation_effect',
array(
'label' => esc_html__( 'Animation Effect', 'jet-elements' ),
'type' => Controls_Manager::SELECT,
'default' => 'lily',
'options' => array(
'none' => esc_html__( 'None', 'jet-elements' ),
'lily' => esc_html__( 'Lily', 'jet-elements' ),
'sadie' => esc_html__( 'Sadie', 'jet-elements' ),
'layla' => esc_html__( 'Layla', 'jet-elements' ),
'oscar' => esc_html__( 'Oscar', 'jet-elements' ),
'marley' => esc_html__( 'Marley', 'jet-elements' ),
'ruby' => esc_html__( 'Ruby', 'jet-elements' ),
'roxy' => esc_html__( 'Roxy', 'jet-elements' ),
'bubba' => esc_html__( 'Bubba', 'jet-elements' ),
'romeo' => esc_html__( 'Romeo', 'jet-elements' ),
'sarah' => esc_html__( 'Sarah', 'jet-elements' ),
'chico' => esc_html__( 'Chico', 'jet-elements' ),
),
)
);
$this->end_controls_section();
$css_scheme = apply_filters(
'jet-elements/banner/css-scheme',
array(
'banner' => '.jet-banner',
'banner_content' => '.jet-banner__content',
'banner_overlay' => '.jet-banner__overlay',
'banner_title' => '.jet-banner__title',
'banner_text' => '.jet-banner__text',
)
);
$this->_start_controls_section(
'section_banner_item_style',
array(
'label' => esc_html__( 'General', 'jet-elements' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
)
);
$this->_add_control(
'banner_container_heading',
array(
'label' => esc_html__( 'Container', 'jet-elements' ),
'type' => Controls_Manager::HEADING,
),
100
);
$this->_add_responsive_control(
'banner_padding',
array(
'label' => __( 'Padding', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['banner'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
100
);
$this->_add_responsive_control(
'banner_margin',
array(
'label' => __( 'Margin', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['banner'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
100
);
$this->_add_group_control(
Group_Control_Border::get_type(),
array(
'name' => 'banner_border',
'label' => esc_html__( 'Border', 'jet-elements' ),
'placeholder' => '1px',
'selector' => '{{WRAPPER}} ' . $css_scheme['banner'],
),
100
);
$this->_add_control(
'banner_border_radius',
array(
'label' => esc_html__( 'Border Radius', 'jet-elements' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['banner'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
),
100
);
$this->_add_group_control(
Group_Control_Box_Shadow::get_type(),
array(
'name' => 'banner_shadow',
'selector' => '{{WRAPPER}} ' . $css_scheme['banner'],
),
100
);
$this->_add_control(
'banner_overlay_heading',
array(
'label' => esc_html__( 'Overlay', 'jet-elements' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
),
25
);
$this->_start_controls_tabs( 'tabs_background' );
$this->_start_controls_tab(
'tab_background_normal',
array(
'label' => esc_html__( 'Normal', 'jet-elements' ),
)
);
$this->_add_control(
'items_content_color',
array(
'label' => esc_html__( 'Additional Elements Color', 'jet-elements' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} .jet-effect-layla ' . $css_scheme['banner_content'] . '::before' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-layla ' . $css_scheme['banner_content'] . '::after' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-oscar ' . $css_scheme['banner_content'] . '::before' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-marley ' . $css_scheme['banner_title'] . '::after' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-ruby ' . $css_scheme['banner_text'] => 'border-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-roxy ' . $css_scheme['banner_text'] . '::before' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-roxy ' . $css_scheme['banner_content'] . '::before' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-bubba ' . $css_scheme['banner_content'] . '::before' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-bubba ' . $css_scheme['banner_content'] . '::after' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-romeo ' . $css_scheme['banner_content'] . '::before' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-romeo ' . $css_scheme['banner_content'] . '::after' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-sarah ' . $css_scheme['banner_title'] . '::after' => 'background-color: {{VALUE}}',
'{{WRAPPER}} .jet-effect-chico ' . $css_scheme['banner_content'] . '::before' => 'border-color: {{VALUE}}',
),
),
25
);
$this->_add_group_control(
Group_Control_Background::get_type(),
array(
'name' => 'background',
'selector' => '{{WRAPPER}} ' . $css_scheme['banner_overlay'],
),
25
);
$this->_add_control(
'normal_opacity',
array(
'label' => esc_html__( 'Opacity', 'jet-elements' ),
'type' => Controls_Manager::NUMBER,
'default' => '0',
'min' => 0,
'max' => 1,
'step' => 0.1,
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['banner_overlay'] => 'opacity: {{VALUE}};',
),
),
25
);
$this->_end_controls_tab();
$this->_start_controls_tab(
'tab_background_hover',
array(
'label' => esc_html__( 'Hover', 'jet-elements' ),
)
);
$this->_add_control(
'items_content_hover_color',
array(
'label' => esc_html__( 'Additional Elements Color', 'jet-elements' ),
Loading ...