555 lines
21 KiB
PHP
555 lines
21 KiB
PHP
<?php namespace Elementor;
|
|
|
|
class restly_contact_info_Widget extends Widget_Base {
|
|
|
|
public function get_name() {
|
|
|
|
return 'restly_contact_info';
|
|
}
|
|
|
|
public function get_title() {
|
|
return esc_html__( 'Restly Contact Info', 'restlycore' );
|
|
}
|
|
|
|
public function get_icon() {
|
|
|
|
return 'eicon-info-circle';
|
|
}
|
|
|
|
public function get_categories() {
|
|
return ['restly'];
|
|
}
|
|
|
|
protected function register_controls() {
|
|
|
|
//Content tab start
|
|
$this->start_controls_section(
|
|
'restly_contact_info_options',
|
|
[
|
|
'label' => esc_html__( 'Restly Contact Info', 'restlycore' ),
|
|
'tab' => Controls_Manager::TAB_CONTENT,
|
|
]
|
|
);
|
|
$this->add_control(
|
|
'restly_contact_info_hadding',
|
|
[
|
|
'label' => esc_html__( 'Title', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::TEXTAREA,
|
|
'default' => esc_html__( 'Dont hesitate to contact us', 'restlycore' ),
|
|
'show_label' => true,
|
|
]
|
|
);
|
|
$this->add_control(
|
|
'restly_contact_info_tag',
|
|
[
|
|
'label' => esc_html__( 'HTML Tag', 'restlycore' ),
|
|
'description' => esc_html__( 'Add HTML Tag For Title', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::SELECT,
|
|
'default' => 'h2',
|
|
'options' => [
|
|
'h1' => esc_html__( 'H1', 'restlycore' ),
|
|
'h2' => esc_html__( 'H2', 'restlycore' ),
|
|
'h3' => esc_html__( 'H3', 'restlycore' ),
|
|
'h4' => esc_html__( 'H4', 'restlycore' ),
|
|
'h5' => esc_html__( 'H5', 'restlycore' ),
|
|
'h6' => esc_html__( 'H6', 'restlycore' ),
|
|
'p' => esc_html__( 'P', 'restlycore' ),
|
|
'span' => esc_html__( 'span', 'restlycore' ),
|
|
'div' => esc_html__( 'Div', 'restlycore' ),
|
|
],
|
|
]
|
|
);
|
|
$repeater = new \Elementor\Repeater();
|
|
$repeater->add_control(
|
|
'restly_contact_info_icon',
|
|
[
|
|
'label' => esc_html__( 'Icon', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::ICONS,
|
|
'show_label' => true,
|
|
]
|
|
);
|
|
$repeater->add_control(
|
|
'restly_contact_info_label',
|
|
[
|
|
'label' => esc_html__( 'Item Label', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::TEXT,
|
|
'default' => esc_html__( 'Call Us', 'restlycore' ),
|
|
'show_label' => true,
|
|
]
|
|
);
|
|
$repeater->add_control(
|
|
'restly_contact_info_content',
|
|
[
|
|
'label' => esc_html__( 'Content', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::WYSIWYG,
|
|
'default' => __( '<p>+012-345-6789</p>', 'restlycore' ),
|
|
'show_label' => true,
|
|
]
|
|
);
|
|
$this->add_control(
|
|
'restly_contact_info',
|
|
[
|
|
'label' => esc_html__( 'Info List', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::REPEATER,
|
|
'fields' => $repeater->get_controls(),
|
|
'default' => [
|
|
[
|
|
'restly_contact_info_label' => esc_html__( 'Call Us', 'restlycore' ),
|
|
'restly_contact_info_content' => __( '<p>+012-345-6789</p>', 'restlycore' ),
|
|
],
|
|
],
|
|
]
|
|
);
|
|
$this->end_controls_section();
|
|
$this->start_controls_section(
|
|
'restly_contact_info_CSS_options',
|
|
[
|
|
'label' => esc_html__( 'Box', 'restlycore' ),
|
|
'tab' => Controls_Manager::TAB_STYLE,
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_box_align',
|
|
[
|
|
'label' => __( 'Alignment', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::CHOOSE,
|
|
'options' => [
|
|
'left' => [
|
|
'title' => __( 'Left', 'restlycore' ),
|
|
'icon' => 'eicon-text-align-left',
|
|
],
|
|
'center' => [
|
|
'title' => __( 'Center', 'restlycore' ),
|
|
'icon' => 'eicon-text-align-center',
|
|
],
|
|
'right' => [
|
|
'title' => __( 'Right', 'restlycore' ),
|
|
'icon' => 'eicon-text-align-right',
|
|
],
|
|
],
|
|
'default' => 'left',
|
|
'toggle' => true,
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-contact-info' => 'text-align: {{VALUE}}',
|
|
],
|
|
]
|
|
);
|
|
$this->add_group_control(
|
|
\Elementor\Group_Control_Background::get_type(),
|
|
[
|
|
'name' => 'restly_contact_info_CSS_box_bg',
|
|
'label' => esc_html__( 'Background', 'restlycore' ),
|
|
'types' => [ 'classic', 'gradient', 'video' ],
|
|
'selector' => '{{WRAPPER}} .restly-contact-info',
|
|
]
|
|
);
|
|
$this->add_group_control(
|
|
\Elementor\Group_Control_Box_Shadow::get_type(),
|
|
[
|
|
'name' => 'restly_contact_info_CSS_box_shadwo',
|
|
'label' => esc_html__( 'Box Shadow', 'restlycore' ),
|
|
'selector' => '{{WRAPPER}} .restly-contact-info',
|
|
]
|
|
);
|
|
$this->add_group_control(
|
|
\Elementor\Group_Control_Border::get_type(),
|
|
[
|
|
'name' => 'restly_contact_info_CSS_box_border',
|
|
'label' => esc_html__( 'Border', 'restlycore' ),
|
|
'selector' => '{{WRAPPER}} .restly-contact-info',
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_box_radius',
|
|
[
|
|
'label' => esc_html__( 'Border Radius', 'restlycore' ),
|
|
'type' => Controls_Manager::SLIDER,
|
|
'size_units' => [ 'px' ],
|
|
'range' => [
|
|
'px' => [
|
|
'min' => 0,
|
|
'max' => 100,
|
|
'step' => 1,
|
|
]
|
|
],
|
|
'default' => [
|
|
'unit' => 'px',
|
|
'size' => 5,
|
|
],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-contact-info' => 'border-radius: {{SIZE}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_box_margin',
|
|
[
|
|
'label' => esc_html__( 'Margin', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-contact-info' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_box_padding',
|
|
[
|
|
'label' => esc_html__( 'Padding', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-contact-info' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->end_controls_section();
|
|
$this->start_controls_section(
|
|
'restly_contact_info_CSS_icon_options',
|
|
[
|
|
'label' => esc_html__( 'Icon', 'restlycore' ),
|
|
'tab' => Controls_Manager::TAB_STYLE,
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_icon_color',
|
|
[
|
|
'label' => esc_html__( 'Color', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::COLOR,
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-icon i' => 'color: {{VALUE}}',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_icon_colorbg',
|
|
[
|
|
'label' => esc_html__( 'Background Color', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::COLOR,
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-icon i' => 'background-color: {{VALUE}}',
|
|
],
|
|
]
|
|
);
|
|
$this->add_group_control(
|
|
\Elementor\Group_Control_Typography::get_type(),
|
|
[
|
|
'name' => 'restly_contact_info_CSS_icon_typo',
|
|
'label' => esc_html__( 'Typography', 'restlycore' ),
|
|
'selector' => '{{WRAPPER}} .restly-cinfo-icon i',
|
|
'exclude' => [
|
|
'letter_spacing',
|
|
'text_transform',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_icon_width',
|
|
[
|
|
'label' => esc_html__( 'Width', 'restlycore' ),
|
|
'type' => Controls_Manager::SLIDER,
|
|
'size_units' => [ 'px'],
|
|
'range' => [
|
|
'px' => [
|
|
'min' => 0,
|
|
'max' => 100,
|
|
'step' => 1,
|
|
],
|
|
],
|
|
'default' => [
|
|
'unit' => 'px',
|
|
'size' => 40,
|
|
],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-icon i' => 'width: {{SIZE}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_icon_height',
|
|
[
|
|
'label' => esc_html__( 'Height', 'restlycore' ),
|
|
'type' => Controls_Manager::SLIDER,
|
|
'size_units' => [ 'px' ],
|
|
'range' => [
|
|
'px' => [
|
|
'min' => 0,
|
|
'max' => 100,
|
|
'step' => 1,
|
|
],
|
|
],
|
|
'default' => [
|
|
'unit' => 'px',
|
|
'size' => 40,
|
|
],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-icon i' => 'height: {{SIZE}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_icon_radius',
|
|
[
|
|
'label' => esc_html__( 'Border Radius', 'restlycore' ),
|
|
'type' => Controls_Manager::SLIDER,
|
|
'size_units' => [ '%' ],
|
|
'range' => [
|
|
'%' => [
|
|
'min' => 0,
|
|
'max' => 100,
|
|
'step' => 1,
|
|
],
|
|
],
|
|
'default' => [
|
|
'unit' => '%',
|
|
'size' => 100,
|
|
],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-icon i' => 'border-radius: {{SIZE}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_icon_margin',
|
|
[
|
|
'label' => esc_html__( 'Margin', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'default' => [
|
|
'top' => '0',
|
|
'right' => '20',
|
|
'bottom' => '0',
|
|
'left' => '0',
|
|
'isLinked' => true
|
|
],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-icon i' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_icon_padding',
|
|
[
|
|
'label' => esc_html__( 'Padding', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-icon i' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->end_controls_section();
|
|
$this->start_controls_section(
|
|
'restly_contact_info_CSS_content_options',
|
|
[
|
|
'label' => esc_html__( 'Content', 'restlycore' ),
|
|
'tab' => Controls_Manager::TAB_STYLE,
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_CSS_content_item_margin',
|
|
[
|
|
'label' => esc_html__( 'Item Margin', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'default' => [
|
|
'top' => '0',
|
|
'right' => '0',
|
|
'bottom' => '45',
|
|
'left' => '0',
|
|
'isLinked' => true
|
|
],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->start_controls_tabs(
|
|
'restly_contact_info_tabs'
|
|
);
|
|
$this->start_controls_tab(
|
|
'restly_contact_info_tabs_hadding',
|
|
[
|
|
'label' => __( 'Title', 'restlycore' ),
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_hadding_color',
|
|
[
|
|
'label' => esc_html__( 'Color', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::COLOR,
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-contact-info .contact-info-title' => 'color: {{VALUE}}',
|
|
],
|
|
]
|
|
);
|
|
$this->add_group_control(
|
|
\Elementor\Group_Control_Typography::get_type(),
|
|
[
|
|
'name' => 'restly_contact_info_hadding_typo',
|
|
'label' => esc_html__( 'Typography', 'restlycore' ),
|
|
'selector' => '{{WRAPPER}} .restly-contact-info .contact-info-title',
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_hadding_margin',
|
|
[
|
|
'label' => esc_html__( 'Margin', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-contact-info .contact-info-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_hadding_padding',
|
|
[
|
|
'label' => esc_html__( 'Padding', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-contact-info .contact-info-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->end_controls_tab();
|
|
|
|
$this->start_controls_tab(
|
|
'restly_contact_info_tabs_label',
|
|
[
|
|
'label' => __( 'Label', 'restlycore' ),
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_label_color',
|
|
[
|
|
'label' => esc_html__( 'Color', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::COLOR,
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-dec span' => 'color: {{VALUE}}',
|
|
],
|
|
]
|
|
);
|
|
$this->add_group_control(
|
|
\Elementor\Group_Control_Typography::get_type(),
|
|
[
|
|
'name' => 'restly_contact_info_label_typo',
|
|
'label' => esc_html__( 'Typography', 'restlycore' ),
|
|
'selector' => '{{WRAPPER}} .restly-cinfo-dec span',
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_label_margin',
|
|
[
|
|
'label' => esc_html__( 'Margin', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-dec span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_label_padding',
|
|
[
|
|
'label' => esc_html__( 'Padding', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-dec span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->end_controls_tab();
|
|
|
|
$this->start_controls_tab(
|
|
'restly_contact_tabs_dec',
|
|
[
|
|
'label' => __( 'Content', 'restlycore' ),
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_dec_color',
|
|
[
|
|
'label' => esc_html__( 'Color', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::COLOR,
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-dec p,.restly-cinfo-dec p a' => 'color: {{VALUE}}',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_dec_hcolor',
|
|
[
|
|
'label' => esc_html__( 'Link Hover Color', 'restlycore' ),
|
|
'type' => \Elementor\Controls_Manager::COLOR,
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-dec p a:hover' => 'color: {{VALUE}}',
|
|
],
|
|
]
|
|
);
|
|
$this->add_group_control(
|
|
\Elementor\Group_Control_Typography::get_type(),
|
|
[
|
|
'name' => 'restly_contact_info_dec_typo',
|
|
'label' => esc_html__( 'Typography', 'restlycore' ),
|
|
'selector' => '{{WRAPPER}} .restly-cinfo-dec p',
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_dec_margin',
|
|
[
|
|
'label' => esc_html__( 'Margin', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-dec p' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->add_responsive_control(
|
|
'restly_contact_info_dec_padding',
|
|
[
|
|
'label' => esc_html__( 'Padding', 'restlycore' ),
|
|
'type' => Controls_Manager::DIMENSIONS,
|
|
'size_units' => [ 'px', '%', 'em' ],
|
|
'selectors' => [
|
|
'{{WRAPPER}} .restly-cinfo-dec p' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
|
|
],
|
|
]
|
|
);
|
|
$this->end_controls_tab();
|
|
$this->end_controls_tabs();
|
|
$this->end_controls_section();
|
|
}
|
|
//Render
|
|
protected function render() {
|
|
$settings = $this->get_settings_for_display();
|
|
ob_start();
|
|
?>
|
|
<div class="restly-contact-info-warpper">
|
|
<div class="restly-contact-info">
|
|
<?php if(!empty($settings['restly_contact_info_hadding'])){
|
|
echo '<'.esc_attr($settings['restly_contact_info_tag']).' class="contact-info-title">'.esc_html($settings['restly_contact_info_hadding']).'</'.esc_attr($settings['restly_contact_info_tag']).'>';
|
|
} ?>
|
|
<div class="restly-contact-info-items">
|
|
<?php foreach($settings['restly_contact_info'] as $restly_cinfo ) : ?>
|
|
<div class="restly-cinfo d-flex align-items-center">
|
|
<div class="restly-cinfo-icon">
|
|
<i class="<?php echo esc_attr($restly_cinfo['restly_contact_info_icon']['value']); ?>"></i>
|
|
</div>
|
|
<div class="restly-cinfo-dec">
|
|
<span><?php echo esc_html($restly_cinfo['restly_contact_info_label']); ?></span>
|
|
<?php echo wp_kses($restly_cinfo['restly_contact_info_content'],'restly_allowed_html'); ?>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
echo ob_get_clean();
|
|
}
|
|
}
|
|
Plugin::instance()->widgets_manager->register( new restly_contact_info_Widget );
|