File manager - Edit - /home/boiitech111/autorollingright.com/wp-content/themes/carutos/inc/vendor/elementor/widgets/call-to-action.php
Back
<?php 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; use Elementor\Utils; if (!defined('ABSPATH')) { exit; // Exit if accessed directly } class WPOPAL_Elementor_Call_to_action_Widget extends Elementor\Widget_Base { public function get_name() { return 'call-to-action'; } public function get_categories() { return ['opal-addons']; } public function get_title() { return esc_html__('Call to Action', 'carutos'); } public function get_icon() { return 'eicon-image-rollover'; } protected function register_controls() { $this->start_controls_section( 'section_main_image', [ 'label' => esc_html__('Image', 'carutos'), ] ); $this->add_control( 'skin', [ 'label' => esc_html__('Skin', 'carutos'), 'type' => Controls_Manager::SELECT, 'options' => [ 'classic' => esc_html__('Classic', 'carutos'), 'cover' => esc_html__('Cover', 'carutos'), ], 'render_type' => 'template', 'prefix_class' => 'elementor-cta--skin-', 'default' => 'classic', ] ); $this->add_responsive_control( 'layout', [ 'label' => esc_html__('Layout', 'carutos'), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'carutos'), 'icon' => 'eicon-h-align-left', ], 'above' => [ 'title' => esc_html__('Above', 'carutos'), 'icon' => 'eicon-v-align-top', ], 'right' => [ 'title' => esc_html__('Right', 'carutos'), 'icon' => 'eicon-h-align-right', ], ], 'prefix_class' => 'elementor-cta-%s-layout-image-', 'condition' => [ 'skin!' => 'cover', ], ] ); $this->add_control( 'bg_image', [ 'label' => esc_html__('Choose Image', 'carutos'), 'type' => Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'show_label' => false, ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'bg_image', // Actually its `image_size` 'label' => esc_html__('Image Resolution', 'carutos'), 'default' => 'large', 'condition' => [ 'bg_image[id]!' => '', ], 'separator' => 'none', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_content', [ 'label' => esc_html__('Content', 'carutos'), ] ); $this->add_control( 'graphic_element', [ 'label' => esc_html__('Graphic Element', 'carutos'), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'options' => [ 'none' => [ 'title' => esc_html__('None', 'carutos'), 'icon' => 'fa fa-ban', ], 'image' => [ 'title' => esc_html__('Image', 'carutos'), 'icon' => 'fa fa-picture-o', ], 'icon' => [ 'title' => esc_html__('Icon', 'carutos'), 'icon' => 'fa fa-star', ], ], 'separator' => 'before', 'default' => 'none', ] ); $this->add_control( 'graphic_image', [ 'label' => esc_html__('Choose Image', 'carutos'), 'type' => Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'condition' => [ 'graphic_element' => 'image', ], 'show_label' => false, ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'graphic_image', // Actually its `image_size` 'default' => 'thumbnail', 'condition' => [ 'graphic_element' => 'image', 'graphic_image[id]!' => '', ], ] ); $this->add_control( 'icon', [ 'label' => esc_html__('Icon', 'carutos'), 'type' => Controls_Manager::ICON, 'default' => 'fa fa-star', 'condition' => [ 'graphic_element' => 'icon', ], ] ); $this->add_control( 'icon_view', [ 'label' => esc_html__('View', 'carutos'), 'type' => Controls_Manager::SELECT, 'options' => [ 'default' => esc_html__('Default', 'carutos'), 'stacked' => esc_html__('Stacked', 'carutos'), 'framed' => esc_html__('Framed', 'carutos'), ], 'default' => 'default', 'condition' => [ 'graphic_element' => 'icon', ], ] ); $this->add_control( 'icon_shape', [ 'label' => esc_html__('Shape', 'carutos'), 'type' => Controls_Manager::SELECT, 'options' => [ 'circle' => esc_html__('Circle', 'carutos'), 'square' => esc_html__('Square', 'carutos'), ], 'default' => 'circle', 'condition' => [ 'icon_view!' => 'default', 'graphic_element' => 'icon', ], ] ); $this->add_control( 'title', [ 'label' => esc_html__('Title & Description', 'carutos'), 'type' => Controls_Manager::TEXT, 'default' => esc_html__('This is the heading', 'carutos'), 'placeholder' => esc_html__('Enter your title', 'carutos'), 'label_block' => true, 'separator' => 'before', ] ); $this->add_control( 'description', [ 'label' => esc_html__('Description', 'carutos'), 'type' => Controls_Manager::TEXTAREA, 'default' => esc_html__('Click edit button to change this text. Lorem ipsum dolor sit amet consectetur adipiscing elit dolor', 'carutos'), 'placeholder' => esc_html__('Enter your description', 'carutos'), 'separator' => 'none', 'rows' => 5, 'show_label' => false, ] ); $this->add_control( 'title_tag', [ 'label' => esc_html__('Title HTML Tag', 'carutos'), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => esc_html__('H1', 'carutos'), 'h2' => esc_html__('H2', 'carutos'), 'h3' => esc_html__('H3', 'carutos'), 'h4' => esc_html__('H4', 'carutos'), 'h5' => esc_html__('H5', 'carutos'), 'h6' => esc_html__('H6', 'carutos'), 'div' => esc_html__('div', 'carutos'), 'span' => esc_html__('span', 'carutos'), ], 'default' => 'h2', 'condition' => [ 'title!' => '', ], ] ); $this->add_control( 'button', [ 'label' => esc_html__('Button Text', 'carutos'), 'type' => Controls_Manager::TEXT, 'default' => esc_html__('Click Here', 'carutos'), 'separator' => 'before', ] ); $this->add_control( 'button_icon', [ 'label' => esc_html__('Button Icon', 'carutos'), 'type' => Controls_Manager::ICON, 'label_block' => true, 'default' => '', ] ); $this->add_control( 'button_icon_align', [ 'label' => esc_html__('Icon Position', 'carutos'), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => esc_html__('Before', 'carutos'), 'right' => esc_html__('After', 'carutos'), ], 'condition' => [ 'icon!' => '', ], ] ); $this->add_control( 'link', [ 'label' => esc_html__('Link', 'carutos'), 'type' => Controls_Manager::URL, 'placeholder' => esc_html__('https://your-link.com', 'carutos'), ] ); $this->add_control( 'link_click', [ 'label' => esc_html__('Apply Link On', 'carutos'), 'type' => Controls_Manager::SELECT, 'options' => [ 'box' => esc_html__('Whole Box', 'carutos'), 'button' => esc_html__('Button Only', 'carutos'), ], 'default' => 'button', 'separator' => 'none', 'condition' => [ 'link[url]!' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_ribbon', [ 'label' => esc_html__('Ribbon', 'carutos'), ] ); $this->add_control( 'ribbon_title', [ 'label' => esc_html__('Title', 'carutos'), 'type' => Controls_Manager::TEXT, ] ); $this->add_control( 'ribbon_horizontal_position', [ 'label' => esc_html__('Horizontal Position', 'carutos'), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'carutos'), 'icon' => 'eicon-h-align-left', ], 'right' => [ 'title' => esc_html__('Right', 'carutos'), 'icon' => 'eicon-h-align-right', ], ], 'condition' => [ 'ribbon_title!' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'box_style', [ 'label' => esc_html__('Box', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'min-height', [ 'label' => esc_html__('Min. Height', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 100, 'max' => 1000, ], 'vh' => [ 'min' => 10, 'max' => 100, ], ], 'size_units' => ['px', 'vh'], 'selectors' => [ '{{WRAPPER}} .elementor-cta__content' => 'min-height: {{SIZE}}{{UNIT}}', ], 'separator' => 'before', ] ); $this->add_control( 'alignment', [ 'label' => esc_html__('Alignment', 'carutos'), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'carutos'), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => esc_html__('Center', 'carutos'), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => esc_html__('Right', 'carutos'), 'icon' => 'fa fa-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .elementor-cta__content' => 'text-align: {{VALUE}}', ], ] ); $this->add_control( 'vertical_position', [ 'label' => esc_html__('Vertical Position', 'carutos'), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'options' => [ 'top' => [ 'title' => esc_html__('Top', 'carutos'), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => esc_html__('Middle', 'carutos'), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => esc_html__('Bottom', 'carutos'), 'icon' => 'eicon-v-align-bottom', ], ], 'prefix_class' => 'elementor-cta--valign-', 'separator' => 'none', ] ); $this->add_responsive_control( 'padding', [ 'label' => esc_html__('Padding', 'carutos'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .elementor-cta__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', ], ] ); $this->add_control( 'heading_bg_image_style', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__('Image', 'carutos'), 'condition' => [ 'bg_image[url]!' => '', 'skin' => 'classic', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'image_min_width', [ 'label' => esc_html__('Min. Width', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => ['px', '%'], 'selectors' => [ '{{WRAPPER}} .elementor-cta__bg-wrapper' => 'min-width: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'skin' => 'classic', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'image_min_height', [ 'label' => esc_html__('Min. Height', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], 'vh' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => ['px', 'vh'], 'selectors' => [ '{{WRAPPER}} .elementor-cta__bg-wrapper' => 'min-height: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'skin' => 'classic', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'graphic_element_style', [ 'label' => esc_html__('Graphic Element', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'graphic_element!' => 'none', ], ] ); $this->add_control( 'graphic_image_spacing', [ 'label' => esc_html__('Spacing', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-cta__image' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'graphic_element' => 'image', ], ] ); $this->add_control( 'graphic_image_width', [ 'label' => esc_html__('Size (%)', 'carutos'), 'type' => Controls_Manager::SLIDER, 'size_units' => ['%'], 'default' => [ 'unit' => '%', ], 'range' => [ '%' => [ 'min' => 5, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-cta__image img' => 'width: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'graphic_element' => 'image', ], ] ); $this->add_control( 'graphic_image_opacity', [ 'label' => esc_html__('Opacity', 'carutos'), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-cta__image' => 'opacity: {{SIZE}};', ], 'condition' => [ 'graphic_element' => 'image', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'graphic_image_border', 'selector' => '{{WRAPPER}} .elementor-cta__image img', 'condition' => [ 'graphic_element' => 'image', ], 'separator' => 'before', ] ); $this->add_control( 'graphic_image_border_radius', [ 'label' => esc_html__('Border Radius', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-cta__image img' => 'border-radius: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'graphic_element' => 'image', ], ] ); $this->add_control( 'icon_spacing', [ 'label' => esc_html__('Spacing', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-icon-wrapper' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'graphic_element' => 'icon', ], ] ); $this->add_control( 'icon_primary_color', [ 'label' => esc_html__('Primary Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .elementor-view-stacked .elementor-icon' => 'background-color: {{VALUE}}', '{{WRAPPER}} .elementor-view-framed .elementor-icon, {{WRAPPER}} .elementor-view-default .elementor-icon' => 'color: {{VALUE}}; border-color: {{VALUE}}', ], 'condition' => [ 'graphic_element' => 'icon', ], ] ); $this->add_control( 'icon_secondary_color', [ 'label' => esc_html__('Secondary Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'graphic_element' => 'icon', 'icon_view!' => 'default', ], 'selectors' => [ '{{WRAPPER}} .elementor-view-framed .elementor-icon' => 'background-color: {{VALUE}};', '{{WRAPPER}} .elementor-view-stacked .elementor-icon' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'icon_size', [ 'label' => esc_html__('Icon Size', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 6, 'max' => 300, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-icon' => 'font-size: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'graphic_element' => 'icon', ], ] ); $this->add_control( 'icon_padding', [ 'label' => esc_html__('Icon Padding', 'carutos'), 'type' => Controls_Manager::SLIDER, 'selectors' => [ '{{WRAPPER}} .elementor-icon' => 'padding: {{SIZE}}{{UNIT}};', ], 'range' => [ 'em' => [ 'min' => 0, 'max' => 5, ], ], 'condition' => [ 'graphic_element' => 'icon', 'icon_view!' => 'default', ], ] ); $this->add_control( 'icon_border_width', [ 'label' => esc_html__('Border Width', 'carutos'), 'type' => Controls_Manager::SLIDER, 'selectors' => [ '{{WRAPPER}} .elementor-icon' => 'border-width: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'graphic_element' => 'icon', 'icon_view' => 'framed', ], ] ); $this->add_control( 'icon_border_radius', [ 'label' => esc_html__('Border Radius', 'carutos'), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'selectors' => [ '{{WRAPPER}} .elementor-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'graphic_element' => 'icon', 'icon_view!' => 'default', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_content_style', [ 'label' => esc_html__('Content', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'title', 'operator' => '!==', 'value' => '', ], [ 'name' => 'description', 'operator' => '!==', 'value' => '', ], [ 'name' => 'button', 'operator' => '!==', 'value' => '', ], ], ], ] ); $this->add_control( 'heading_style_title', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__('Title', 'carutos'), 'separator' => 'before', 'condition' => [ 'title!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .elementor-cta__title', 'condition' => [ 'title!' => '', ], ] ); $this->add_responsive_control( 'title_spacing', [ 'label' => esc_html__('Spacing', 'carutos'), 'type' => Controls_Manager::SLIDER, 'selectors' => [ '{{WRAPPER}} .elementor-cta__title:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'title!' => '', ], ] ); $this->add_control( 'heading_style_description', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__('Description', 'carutos'), 'separator' => 'before', 'condition' => [ 'description!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'description_typography', 'selector' => '{{WRAPPER}} .elementor-cta__description', 'condition' => [ 'description!' => '', ], ] ); $this->add_responsive_control( 'description_spacing', [ 'label' => esc_html__('Spacing', 'carutos'), 'type' => Controls_Manager::SLIDER, 'selectors' => [ '{{WRAPPER}} .elementor-cta__description:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'description!' => '', ], ] ); $this->add_control( 'heading_content_colors', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__('Colors', 'carutos'), 'separator' => 'before', ] ); $this->start_controls_tabs('color_tabs'); $this->start_controls_tab('colors_normal', [ 'label' => esc_html__('Normal', 'carutos'), ] ); $this->add_control( 'content_bg_color', [ 'label' => esc_html__('Background Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta__content' => 'background-color: {{VALUE}}', ], 'condition' => [ 'skin' => 'classic', ], ] ); $this->add_control( 'title_color', [ 'label' => esc_html__('Title Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta__title' => 'color: {{VALUE}}', ], 'condition' => [ 'title!' => '', ], ] ); $this->add_control( 'description_color', [ 'label' => esc_html__('Description Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta__description' => 'color: {{VALUE}}', ], 'condition' => [ 'description!' => '', ], ] ); $this->add_control( 'button_color', [ 'label' => esc_html__('Button Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta__button' => 'color: {{VALUE}}; border-color: {{VALUE}}', ], 'condition' => [ 'button!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'colors_hover', [ 'label' => esc_html__('Hover', 'carutos'), ] ); $this->add_control( 'content_bg_color_hover', [ 'label' => esc_html__('Background Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta:hover .elementor-cta__content' => 'background-color: {{VALUE}}', ], 'condition' => [ 'skin' => 'classic', ], ] ); $this->add_control( 'title_color_hover', [ 'label' => esc_html__('Title Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta:hover .elementor-cta__title' => 'color: {{VALUE}}', ], 'condition' => [ 'title!' => '', ], ] ); $this->add_control( 'description_color_hover', [ 'label' => esc_html__('Description Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta:hover .elementor-cta__description' => 'color: {{VALUE}}', ], 'condition' => [ 'description!' => '', ], ] ); $this->add_control( 'button_color_hover', [ 'label' => esc_html__('Button Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta:hover .elementor-cta__button' => 'color: {{VALUE}}; border-color: {{VALUE}}', ], 'condition' => [ 'button!' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'button_style', [ 'label' => esc_html__('Button', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'button!' => '', ], ] ); $this->add_control( 'button_size', [ 'label' => esc_html__('Size', 'carutos'), 'type' => Controls_Manager::SELECT, 'default' => 'sm', 'options' => [ 'xs' => esc_html__('Extra Small', 'carutos'), 'sm' => esc_html__('Small', 'carutos'), 'md' => esc_html__('Medium', 'carutos'), 'lg' => esc_html__('Large', 'carutos'), 'xl' => esc_html__('Extra Large', 'carutos'), ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'label' => esc_html__('Typography', 'carutos'), 'selector' => '{{WRAPPER}} .elementor-cta__button', ] ); $this->start_controls_tabs('button_tabs'); $this->start_controls_tab('button_normal', [ 'label' => esc_html__('Normal', 'carutos'), ] ); $this->add_control( 'button_text_color', [ 'label' => esc_html__('Text Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta__button' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_background_color', [ 'label' => esc_html__('Background Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta__button' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'button_border_color', [ 'label' => esc_html__('Border Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta__button' => 'border-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'button-hover', [ 'label' => esc_html__('Hover', 'carutos'), ] ); $this->add_control( 'button_hover_text_color', [ 'label' => esc_html__('Text Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta__button:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_background_color', [ 'label' => esc_html__('Background Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta__button:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_border_color', [ 'label' => esc_html__('Border Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta__button:hover' => 'border-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'button_border_width', [ 'label' => esc_html__('Border Width', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 20, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-cta__button' => 'border-width: {{SIZE}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_control( 'button_border_radius', [ 'label' => esc_html__('Border Radius', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-cta__button' => 'border-radius: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_ribbon_style', [ 'label' => esc_html__('Ribbon', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, 'show_label' => false, 'condition' => [ 'ribbon_title!' => '', ], ] ); $this->add_control( 'ribbon_bg_color', [ 'label' => esc_html__('Background Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-ribbon-inner' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'ribbon_text_color', [ 'label' => esc_html__('Text Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-ribbon-inner' => 'color: {{VALUE}}', ], ] ); $ribbon_distance_transform = is_rtl() ? 'translateY(-50%) translateX({{SIZE}}{{UNIT}}) rotate(-45deg)' : 'translateY(-50%) translateX(-50%) translateX({{SIZE}}{{UNIT}}) rotate(-45deg)'; $this->add_responsive_control( 'ribbon_distance', [ 'label' => esc_html__('Distance', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-ribbon-inner' => 'margin-top: {{SIZE}}{{UNIT}}; transform: ' . $ribbon_distance_transform, ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'ribbon_typography', 'selector' => '{{WRAPPER}} .elementor-ribbon-inner', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'box_shadow', 'selector' => '{{WRAPPER}} .elementor-ribbon-inner', ] ); $this->end_controls_section(); $this->start_controls_section( 'hover_effects', [ 'label' => esc_html__('Hover Effects', 'carutos'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'content_hover_heading', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__('Content', 'carutos'), 'separator' => 'before', 'condition' => [ 'skin' => 'cover', ], ] ); $this->add_control( 'content_animation', [ 'label' => esc_html__('Hover Animation', 'carutos'), 'type' => Controls_Manager::SELECT, 'groups' => [ [ 'label' => esc_html__('None', 'carutos'), 'options' => [ '' => esc_html__('None', 'carutos'), ], ], [ 'label' => esc_html__('Entrance', 'carutos'), 'options' => [ 'enter-from-right' => esc_html__('Slide In Right', 'carutos'), 'enter-from-left' => esc_html__('Slide In Left', 'carutos'), 'enter-from-top' => esc_html__('Slide In Up', 'carutos'), 'enter-from-bottom' => esc_html__('Slide In Down', 'carutos'), 'enter-zoom-in' => esc_html__('Zoom In', 'carutos'), 'enter-zoom-out' => esc_html__('Zoom Out', 'carutos'), 'fade-in' => esc_html__('Fade In', 'carutos'), ], ], [ 'label' => esc_html__('Reaction', 'carutos'), 'options' => [ 'grow' => esc_html__('Grow', 'carutos'), 'shrink' => esc_html__('Shrink', 'carutos'), 'move-right' => esc_html__('Move Right', 'carutos'), 'move-left' => esc_html__('Move Left', 'carutos'), 'move-up' => esc_html__('Move Up', 'carutos'), 'move-down' => esc_html__('Move Down', 'carutos'), ], ], [ 'label' => esc_html__('Exit', 'carutos'), 'options' => [ 'exit-to-right' => esc_html__('Slide Out Right', 'carutos'), 'exit-to-left' => esc_html__('Slide Out Left', 'carutos'), 'exit-to-top' => esc_html__('Slide Out Up', 'carutos'), 'exit-to-bottom' => esc_html__('Slide Out Down', 'carutos'), 'exit-zoom-in' => esc_html__('Zoom In', 'carutos'), 'exit-zoom-out' => esc_html__('Zoom Out', 'carutos'), 'fade-out' => esc_html__('Fade Out', 'carutos'), ], ], ], 'default' => 'grow', 'condition' => [ 'skin' => 'cover', ], ] ); /* * * Add class 'elementor-animated-content' to widget when assigned content animation * */ $this->add_control( 'animation_class', [ 'label' => esc_html__('Animation', 'carutos'), 'type' => Controls_Manager::HIDDEN, 'default' => 'animated-content', 'prefix_class' => 'elementor-', 'condition' => [ 'content_animation!' => '', ], ] ); $this->add_control( 'content_animation_duration', [ 'label' => esc_html__('Animation Duration', 'carutos'), 'type' => Controls_Manager::SLIDER, 'render_type' => 'template', 'default' => [ 'size' => 1000, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 3000, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-cta__content-item' => 'transition-duration: {{SIZE}}ms', '{{WRAPPER}}.elementor-cta--sequenced-animation .elementor-cta__content-item:nth-child(2)' => 'transition-delay: calc( {{SIZE}}ms / 3 )', '{{WRAPPER}}.elementor-cta--sequenced-animation .elementor-cta__content-item:nth-child(3)' => 'transition-delay: calc( ( {{SIZE}}ms / 3 ) * 2 )', '{{WRAPPER}}.elementor-cta--sequenced-animation .elementor-cta__content-item:nth-child(4)' => 'transition-delay: calc( ( {{SIZE}}ms / 3 ) * 3 )', ], 'condition' => [ 'content_animation!' => '', 'skin' => 'cover', ], ] ); $this->add_control( 'description_animation', [ 'label' => esc_html__('Description Animation', 'carutos'), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__('On', 'carutos'), 'label_off' => esc_html__('Off', 'carutos'), 'return_value' => ' elementor-cta--description-animation', 'prefix_class' => '', 'condition' => [ 'content_animation!' => '', ], ] ); $this->add_responsive_control( 'description_height', [ 'label' => esc_html__('Description_ Height', 'carutos'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 100, 'max' => 1000, ], 'vh' => [ 'min' => 10, 'max' => 100, ], ], 'size_units' => ['px', 'vh'], 'selectors' => [ '{{WRAPPER}}.elementor-cta--description-animation:hover .elementor-cta__description' => 'height: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'description_animation!' => '', ], ] ); $this->add_control( 'sequenced_animation', [ 'label' => esc_html__('Sequenced Animation', 'carutos'), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__('On', 'carutos'), 'label_off' => esc_html__('Off', 'carutos'), 'return_value' => 'elementor-cta--sequenced-animation', 'prefix_class' => '', 'condition' => [ 'content_animation!' => '', ], ] ); $this->add_control( 'background_hover_heading', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__('Background', 'carutos'), 'separator' => 'before', 'condition' => [ 'skin' => 'cover', ], ] ); $this->add_control( 'transformation', [ 'label' => esc_html__('Hover Animation', 'carutos'), 'type' => Controls_Manager::SELECT, 'options' => [ '' => esc_html__('None', 'carutos'), 'zoom-in' => esc_html__('Zoom In', 'carutos'), 'zoom-out' => esc_html__('Zoom Out', 'carutos'), 'move-left' => esc_html__('Move Left', 'carutos'), 'move-right' => esc_html__('Move Right', 'carutos'), 'move-up' => esc_html__('Move Up', 'carutos'), 'move-down' => esc_html__('Move Down', 'carutos'), ], 'default' => 'zoom-in', 'prefix_class' => 'elementor-bg-transform elementor-bg-transform-', ] ); $this->start_controls_tabs('bg_effects_tabs'); $this->start_controls_tab('normal', [ 'label' => esc_html__('Normal', 'carutos'), ] ); $this->add_control( 'overlay_color', [ 'label' => esc_html__('Overlay Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta:not(:hover) .elementor-cta__bg-overlay' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'overlay_blend_mode', [ 'label' => esc_html__('Blend Mode', 'carutos'), 'type' => Controls_Manager::SELECT, 'options' => [ '' => esc_html__('Normal', 'carutos'), 'multiply' => esc_html__('Multiply', 'carutos'), 'screen' => esc_html__('Screen', 'carutos'), 'overlay' => esc_html__('Overlay', 'carutos'), 'darken' => esc_html__('Darken', 'carutos'), 'lighten' => esc_html__('Lighten', 'carutos'), 'color-dodge' => esc_html__('Color Dodge', 'carutos'), 'saturation' => esc_html__('Saturation', 'carutos'), 'color' => esc_html__('Color', 'carutos'), 'luminosity' => esc_html__('Luminosity', 'carutos'), ], 'selectors' => [ '{{WRAPPER}} .elementor-cta__bg-overlay' => 'mix-blend-mode: {{VALUE}}', ], 'separator' => 'none', ] ); $this->end_controls_tab(); $this->start_controls_tab('hover', [ 'label' => esc_html__('Hover', 'carutos'), ] ); $this->add_control( 'overlay_color_hover', [ 'label' => esc_html__('Overlay Color', 'carutos'), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .elementor-cta:hover .elementor-cta__bg-overlay' => 'background-color: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'effect_duration', [ 'label' => esc_html__('Effect Duration', 'carutos'), 'type' => Controls_Manager::SLIDER, 'render_type' => 'template', 'default' => [ 'size' => 1500, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 3000, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-cta .elementor-cta__bg, {{WRAPPER}} .elementor-cta .elementor-cta__bg-overlay' => 'transition-duration: {{SIZE}}ms', ], 'separator' => 'before', ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings(); $title_tag = $settings['title_tag']; $wrapper_tag = 'div'; $button_tag = 'a'; $link_url = empty($settings['link']['url']) ? false : $settings['link']['url']; $bg_image = ''; $content_animation = $settings['content_animation']; $animation_class = ''; $print_bg = true; $print_content = true; if (!empty($settings['bg_image']['id'])) { $bg_image = Group_Control_Image_Size::get_attachment_image_src($settings['bg_image']['id'], 'bg_image', $settings); } elseif (!empty($settings['bg_image']['url'])) { $bg_image = $settings['bg_image']['url']; } if (empty($bg_image) && 'classic' == $settings['skin']) { $print_bg = false; } if (empty($settings['title']) && empty($settings['description']) && empty($settings['button']) && 'none' == $settings['graphic_element']) { $print_content = false; } $this->add_render_attribute('background_image', 'style', [ 'background-image: url(' . $bg_image . ');', ]); $this->add_render_attribute('title', 'class', [ 'elementor-cta__title', 'elementor-cta__content-item', 'elementor-content-item', ]); $this->add_render_attribute('description', 'class', [ 'elementor-cta__description', 'elementor-cta__content-item', 'elementor-content-item', ]); $this->add_render_attribute('button', 'class', [ 'elementor-cta__button', 'elementor-button', 'elementor-size-' . $settings['button_size'], ]); $this->add_render_attribute('graphic_element', 'class', [ 'elementor-content-item', 'elementor-cta__content-item', ] ); if ('icon' === $settings['graphic_element']) { $this->add_render_attribute('graphic_element', 'class', [ 'elementor-icon-wrapper', 'elementor-cta__icon', ] ); $this->add_render_attribute('graphic_element', 'class', 'elementor-view-' . $settings['icon_view']); if ('default' != $settings['icon_view']) { $this->add_render_attribute('graphic_element', 'class', 'elementor-shape-' . $settings['icon_shape']); } if (!empty($settings['icon'])) { $this->add_render_attribute('icon', 'class', $settings['icon']); } } elseif ('image' === $settings['graphic_element'] && !empty($settings['graphic_image']['url'])) { $this->add_render_attribute('graphic_element', 'class', 'elementor-cta__image'); } if (!empty($content_animation) && 'cover' == $settings['skin']) { $animation_class = 'elementor-animated-item--' . $content_animation; $this->add_render_attribute('title', 'class', $animation_class); $this->add_render_attribute('graphic_element', 'class', $animation_class); $this->add_render_attribute('description', 'class', $animation_class); } if (!empty($settings['button_icon'])) { $this->add_render_attribute('icon-align', 'class', 'elementor-button-icon'); $this->add_render_attribute('icon-align', 'class', 'elementor-align-icon-' . $settings['button_icon_align']); } if (!empty($link_url)) { if ('box' === $settings['link_click']) { $wrapper_tag = 'a'; $button_tag = 'button'; $this->add_render_attribute('wrapper', 'href', $link_url); if ($settings['link']['is_external']) { $this->add_render_attribute('wrapper', 'target', '_blank'); } } else { $this->add_render_attribute('button', 'href', $link_url); if ($settings['link']['is_external']) { $this->add_render_attribute('button', 'target', '_blank'); } } } $this->add_inline_editing_attributes('title'); $this->add_inline_editing_attributes('description'); $this->add_inline_editing_attributes('button'); ?> <<?php echo esc_attr($wrapper_tag) . ' ' . $this->get_render_attribute_string('wrapper'); // WPCS: XSS ok.?> class="elementor-cta"> <?php if ($print_bg) : ?> <div class="elementor-cta__bg-wrapper"> <div class="elementor-cta__bg elementor-bg" <?php echo wp_kses_post( $this->get_render_attribute_string('background_image') ); // WPCS: XSS ok.?>></div> <div class="elementor-cta__bg-overlay"></div> </div> <?php endif; ?> <?php if ($print_content) : ?> <div class="elementor-cta__content"> <?php if ('image' === $settings['graphic_element'] && !empty($settings['graphic_image']['url'])) : ?> <div <?php echo wp_kses_post( $this->get_render_attribute_string('graphic_element') ); // WPCS: XSS ok.?>> <?php echo wp_kses_post(Group_Control_Image_Size::get_attachment_image_html($settings, 'graphic_image')); ?> </div> <?php elseif ('icon' === $settings['graphic_element'] && !empty($settings['icon'])) : ?> <div <?php echo wp_kses_post( $this->get_render_attribute_string('graphic_element') ); // WPCS: XSS ok.?>> <div class="elementor-icon"> <i <?php echo wp_kses_post( $this->get_render_attribute_string('icon') ); // WPCS: XSS ok.?>></i> </div> </div> <?php endif; ?> <?php if (!empty($settings['title'])) : ?> <<?php echo esc_attr($title_tag) . ' ' . wp_kses_post( $this->get_render_attribute_string('title') ); ?>> <?php echo wp_kses_post($settings['title']); ?> </<?php echo esc_attr($title_tag); ?>> <?php endif; ?> <?php if (!empty($settings['description'])) : ?> <div <?php echo wp_kses_post( $this->get_render_attribute_string('description') ); //WPCS: XSS ok. ?>> <?php echo esc_html($settings['description']); ?> </div> <?php endif; ?> <?php if (!empty($settings['button'])) : ?> <div class="elementor-cta__button-wrapper elementor-cta__content-item elementor-content-item <?php echo esc_attr($animation_class); ?>"> <<?php echo esc_attr($button_tag) . ' ' . $this->get_render_attribute_string('button'); // WPCS: XSS ok. ?>> <?php echo esc_html($settings['button']); ?> <?php if (!empty($settings['button_icon'])) : ?> <span <?php echo wp_kses_post( $this->get_render_attribute_string('icon-align') ); // WPCS: XSS ok.?>> <i class="<?php echo esc_attr($settings['button_icon']); ?>" aria-hidden="true"></i> </span> <?php endif; ?> </<?php echo esc_attr($button_tag); ?>> </div> <?php endif; ?> </div> <?php endif; ?> <?php if (!empty($settings['ribbon_title'])) : $this->add_render_attribute('ribbon-wrapper', 'class', 'elementor-ribbon'); if (!empty($settings['ribbon_horizontal_position'])) { $this->add_render_attribute('ribbon-wrapper', 'class', 'elementor-ribbon-' . $settings['ribbon_horizontal_position']); } ?> <div <?php echo wp_kses_post( $this->get_render_attribute_string('ribbon-wrapper') ); // WPCS: XSS ok. ?>> <div class="elementor-ribbon-inner"><?php echo esc_html($settings['ribbon_title']); ?></div> </div> <?php endif; ?> </<?php echo esc_attr($wrapper_tag); ?>> <?php } } $widgets_manager->register(new WPOPAL_Elementor_Call_to_action_Widget());
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.05 |
proxy
|
phpinfo
|
Settings