<?php
namespace ElementorPro\Modules\Pricing\Widgets;
use Elementor\Controls_Manager;
use Elementor\Core\Kits\Documents\Tabs\Global_Colors;
use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Icons_Manager;
use Elementor\Repeater;
use ElementorPro\Base\Base_Widget;
use ElementorPro\Core\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
class Price_Table extends Base_Widget {
public function get_name() {
return 'price-table';
}
public function get_title() {
return __( 'Price Table', 'elementor-pro' );
}
public function get_icon() {
return 'eicon-price-table';
}
public function get_keywords() {
return [ 'pricing', 'table', 'product', 'image', 'plan', 'button' ];
}
protected function register_controls() {
$this->start_controls_section(
'section_header',
[
'label' => __( 'Header', 'elementor-pro' ),
]
);
$this->add_control(
'heading',
[
'label' => __( 'Title', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Enter your title', 'elementor-pro' ),
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'sub_heading',
[
'label' => __( 'Description', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Enter your description', 'elementor-pro' ),
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'heading_tag',
[
'label' => __( 'Title HTML Tag', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h2' => 'H2',
'h3' => 'H3',
'h4' => 'H4',
'h5' => 'H5',
'h6' => 'H6',
],
'default' => 'h3',
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_pricing',
[
'label' => __( 'Pricing', 'elementor-pro' ),
]
);
$this->add_control(
'currency_symbol',
[
'label' => __( 'Currency Symbol', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'' => __( 'None', 'elementor-pro' ),
'dollar' => '$ ' . _x( 'Dollar', 'Currency', 'elementor-pro' ),
'euro' => '€ ' . _x( 'Euro', 'Currency', 'elementor-pro' ),
'baht' => '฿ ' . _x( 'Baht', 'Currency', 'elementor-pro' ),
'franc' => '₣ ' . _x( 'Franc', 'Currency', 'elementor-pro' ),
'guilder' => 'ƒ ' . _x( 'Guilder', 'Currency', 'elementor-pro' ),
'krona' => 'kr ' . _x( 'Krona', 'Currency', 'elementor-pro' ),
'lira' => '₤ ' . _x( 'Lira', 'Currency', 'elementor-pro' ),
'peseta' => '₧ ' . _x( 'Peseta', 'Currency', 'elementor-pro' ),
'peso' => '₱ ' . _x( 'Peso', 'Currency', 'elementor-pro' ),
'pound' => '£ ' . _x( 'Pound Sterling', 'Currency', 'elementor-pro' ),
'real' => 'R$ ' . _x( 'Real', 'Currency', 'elementor-pro' ),
'ruble' => '₽ ' . _x( 'Ruble', 'Currency', 'elementor-pro' ),
'rupee' => '₨ ' . _x( 'Rupee', 'Currency', 'elementor-pro' ),
'indian_rupee' => '₹ ' . _x( 'Rupee (Indian)', 'Currency', 'elementor-pro' ),
'shekel' => '₪ ' . _x( 'Shekel', 'Currency', 'elementor-pro' ),
'yen' => '¥ ' . _x( 'Yen/Yuan', 'Currency', 'elementor-pro' ),
'won' => '₩ ' . _x( 'Won', 'Currency', 'elementor-pro' ),
'custom' => __( 'Custom', 'elementor-pro' ),
],
'default' => 'dollar',
]
);
$this->add_control(
'currency_symbol_custom',
[
'label' => __( 'Custom Symbol', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'condition' => [
'currency_symbol' => 'custom',
],
]
);
$this->add_control(
'price',
[
'label' => __( 'Price', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'default' => '39.99',
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'currency_format',
[
'label' => __( 'Currency Format', 'elementor-pro' ),
'type' => Controls_Manager::SELECT,
'options' => [
'' => '1,234.56 (Default)',
',' => '1.234,56',
],
]
);
$this->add_control(
'sale',
[
'label' => __( 'Sale', 'elementor-pro' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => __( 'On', 'elementor-pro' ),
'label_off' => __( 'Off', 'elementor-pro' ),
'default' => '',
]
);
$this->add_control(
'original_price',
[
'label' => __( 'Original Price', 'elementor-pro' ),
'type' => Controls_Manager::NUMBER,
'default' => '59',
'condition' => [
'sale' => 'yes',
],
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'period',
[
'label' => __( 'Period', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Monthly', 'elementor-pro' ),
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_features',
[
'label' => __( 'Features', 'elementor-pro' ),
]
);
$repeater = new Repeater();
$repeater->add_control(
'item_text',
[
'label' => __( 'Text', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'List Item', 'elementor-pro' ),
]
);
$default_icon = [
'value' => 'far fa-check-circle',
'library' => 'fa-regular',
];
$repeater->add_control(
'selected_item_icon',
[
'label' => __( 'Icon', 'elementor-pro' ),
'type' => Controls_Manager::ICONS,
'fa4compatibility' => 'item_icon',
'default' => $default_icon,
]
);
$repeater->add_control(
'item_icon_color',
[
'label' => __( 'Icon Color', 'elementor-pro' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} i' => 'color: {{VALUE}}',
'{{WRAPPER}} {{CURRENT_ITEM}} svg' => 'fill: {{VALUE}}',
],
]
);
$this->add_control(
'features_list',
[
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'default' => [
[
'item_text' => __( 'List Item #1', 'elementor-pro' ),
'selected_item_icon' => $default_icon,
],
[
'item_text' => __( 'List Item #2', 'elementor-pro' ),
'selected_item_icon' => $default_icon,
],
[
'item_text' => __( 'List Item #3', 'elementor-pro' ),
'selected_item_icon' => $default_icon,
],
],
'title_field' => '{{{ item_text }}}',
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_footer',
[
'label' => __( 'Footer', 'elementor-pro' ),
]
);
$this->add_control(
'button_text',
[
'label' => __( 'Button Text', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Click Here', 'elementor-pro' ),
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'link',
[
'label' => __( 'Link', 'elementor-pro' ),
'type' => Controls_Manager::URL,
'placeholder' => __( 'https://your-link.com', 'elementor-pro' ),
'default' => [
'url' => '#',
],
'dynamic' => [
'active' => true,
],
]
);
$this->add_control(
'footer_additional_info',
[
'label' => __( 'Additional Info', 'elementor-pro' ),
'type' => Controls_Manager::TEXTAREA,
'default' => __( 'This is text element', 'elementor-pro' ),
'rows' => 3,
'dynamic' => [
'active' => true,
],
]
);
$this->end_controls_section();
$this->start_controls_section(
'section_ribbon',
[
'label' => __( 'Ribbon', 'elementor-pro' ),
]
);
$this->add_control(
'show_ribbon',
[
'label' => __( 'Show', 'elementor-pro' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'separator' => 'before',
]
);
$this->add_control(
'ribbon_title',
[
'label' => __( 'Title', 'elementor-pro' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Popular', 'elementor-pro' ),
'condition' => [
'show_ribbon' => 'yes',
],
'dynamic' => [
'active' => true,
],
]
);
Loading ...