Files
carpseeds.pl/wp-content/plugins/jet-woo-builder/includes/widgets/single-product/jet-woo-builder-single-meta.php
2024-07-15 11:28:08 +02:00

488 lines
12 KiB
PHP

<?php
/**
* Class: Jet_Woo_Builder_Single_Meta
* Name: Single Meta
* Slug: jet-single-meta
*/
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;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
class Jet_Woo_Builder_Single_Meta extends Jet_Woo_Builder_Base {
public function get_name() {
return 'jet-single-meta';
}
public function get_title() {
return esc_html__( 'Single Meta', 'jet-woo-builder' );
}
public function get_icon() {
return 'jetwoobuilder-icon-6';
}
public function get_script_depends() {
return array();
}
public function get_jet_help_url() {
return 'https://crocoblock.com/knowledge-base/articles/jetwoobuilder-how-to-create-and-set-a-single-product-page-template/';
}
public function get_categories() {
return array( 'jet-woo-builder' );
}
public function show_in_panel() {
return jet_woo_builder()->documents->is_document_type( 'single' );
}
protected function _register_controls() {
$css_scheme = apply_filters(
'jet-woo-builder/jet-single-meta/css-scheme',
array(
'sku' => '.jet-woo-builder .product_meta .sku_wrapper',
'sku_value' => '.jet-woo-builder .product_meta .sku_wrapper .sku',
'categories' => '.jet-woo-builder .product_meta .posted_in',
'categories_link' => '.jet-woo-builder .product_meta .posted_in a',
'tags' => '.jet-woo-builder .product_meta .tagged_as',
'tags_link' => '.jet-woo-builder .product_meta .tagged_as a'
)
);
$this->start_controls_section(
'section_sku_styles',
array(
'label' => esc_html__( 'SKU', 'jet-woo-builder' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
)
);
$this->add_control(
'sku_color',
array(
'label' => esc_html__( 'Color', 'jet-woo-builder' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['sku'] => 'color: {{VALUE}}',
),
)
);
$this->add_group_control(
Group_Control_Typography::get_type(),
array(
'name' => 'sku_typography',
'selector' => '{{WRAPPER}} ' . $css_scheme['sku'],
)
);
$this->add_responsive_control(
'sku_margin',
array(
'label' => __( 'Margin', 'jet-woo-builder' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['sku'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
)
);
$this->add_responsive_control(
'sku__alignment',
array(
'label' => esc_html__( 'Alignment', 'jet-woo-builder' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'options' => array(
'left' => array(
'title' => esc_html__( 'Left', 'jet-woo-builder' ),
'icon' => 'eicon-text-align-left',
),
'center' => array(
'title' => esc_html__( 'Center', 'jet-woo-builder' ),
'icon' => 'eicon-text-align-center',
),
'right' => array(
'title' => esc_html__( 'Right', 'jet-woo-builder' ),
'icon' => 'eicon-text-align-right',
),
),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['sku'] => 'text-align: {{VALUE}};',
),
'classes' => 'elementor-control-align',
)
);
$this->add_control(
'heading_sku_value_styles',
array(
'label' => esc_html__( 'Value', 'jet-woo-builder' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
)
);
$this->add_control(
'sku_value_color',
array(
'label' => esc_html__( 'Color', 'jet-woo-builder' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['sku_value'] => 'color: {{VALUE}}',
),
)
);
$this->add_group_control(
Group_Control_Typography::get_type(),
array(
'name' => 'sku_value_typography',
'selector' => '{{WRAPPER}} ' . $css_scheme['sku_value'],
)
);
$this->end_controls_section();
/**
* Categories Style Section
*/
$this->start_controls_section(
'section_categories_styles',
array(
'label' => esc_html__( 'Categories', 'jet-woo-builder' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
)
);
$this->add_control(
'categories_color',
array(
'label' => esc_html__( 'Color', 'jet-woo-builder' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['categories'] => 'color: {{VALUE}}',
),
)
);
$this->add_group_control(
Group_Control_Typography::get_type(),
array(
'name' => 'categories_typography',
'selector' => '{{WRAPPER}} ' . $css_scheme['categories'],
)
);
$this->add_responsive_control(
'categories_margin',
array(
'label' => __( 'Margin', 'jet-woo-builder' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['categories'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
)
);
$this->add_responsive_control(
'categories_alignment',
array(
'label' => esc_html__( 'Alignment', 'jet-woo-builder' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'options' => array(
'left' => array(
'title' => esc_html__( 'Left', 'jet-woo-builder' ),
'icon' => 'eicon-text-align-left',
),
'center' => array(
'title' => esc_html__( 'Center', 'jet-woo-builder' ),
'icon' => 'eicon-text-align-center',
),
'right' => array(
'title' => esc_html__( 'Right', 'jet-woo-builder' ),
'icon' => 'eicon-text-align-right',
),
),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['categories'] => 'text-align: {{VALUE}};',
),
'classes' => 'elementor-control-align',
)
);
$this->add_control(
'heading_link_categories_styles',
array(
'label' => esc_html__( 'Link', 'jet-woo-builder' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
)
);
$this->add_group_control(
Group_Control_Typography::get_type(),
array(
'name' => 'categories_link_typography',
'selector' => '{{WRAPPER}} ' . $css_scheme['categories_link'],
)
);
$this->start_controls_tabs( 'tabs_categories_link_style' );
$this->start_controls_tab(
'tab_categories_link_normal',
array(
'label' => esc_html__( 'Normal', 'jet-woo-builder' ),
)
);
$this->add_control(
'categories_link_color',
array(
'label' => esc_html__( 'Color', 'jet-woo-builder' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['categories_link'] => 'color: {{VALUE}}',
),
)
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_categories_link_hover',
array(
'label' => esc_html__( 'Hover', 'jet-woo-builder' ),
)
);
$this->add_control(
'categories_link_hover_color',
array(
'label' => esc_html__( 'Color', 'jet-woo-builder' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['categories_link'] . ':hover' => 'color: {{VALUE}}',
),
)
);
$this->add_control(
'categories_link_hover_decoration',
array(
'label' => esc_html__( 'Text Decoration', 'jet-woo-builder' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => array(
'none' => esc_html__( 'None', 'jet-woo-builder' ),
'line-through' => esc_html__( 'Line Through', 'jet-woo-builder' ),
'underline' => esc_html__( 'Underline', 'jet-woo-builder' ),
),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['categories_link'] . ':hover' => 'text-decoration: {{VALUE}}',
),
)
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
/**
* Tags Style Section
*/
$this->start_controls_section(
'section_tags_styles',
array(
'label' => esc_html__( 'Tags', 'jet-woo-builder' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false,
)
);
$this->add_control(
'tags_color',
array(
'label' => esc_html__( 'Color', 'jet-woo-builder' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['tags'] => 'color: {{VALUE}}',
),
)
);
$this->add_group_control(
Group_Control_Typography::get_type(),
array(
'name' => 'tags_typography',
'selector' => '{{WRAPPER}} ' . $css_scheme['tags'],
)
);
$this->add_responsive_control(
'tags_margin',
array(
'label' => __( 'Margin', 'jet-woo-builder' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => array( 'px', '%' ),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['tags'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
),
)
);
$this->add_responsive_control(
'tags_alignment',
array(
'label' => esc_html__( 'Alignment', 'jet-woo-builder' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'options' => array(
'left' => array(
'title' => esc_html__( 'Left', 'jet-woo-builder' ),
'icon' => 'eicon-text-align-left',
),
'center' => array(
'title' => esc_html__( 'Center', 'jet-woo-builder' ),
'icon' => 'eicon-text-align-center',
),
'right' => array(
'title' => esc_html__( 'Right', 'jet-woo-builder' ),
'icon' => 'eicon-text-align-right',
),
),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['tags'] => 'text-align: {{VALUE}};',
),
'classes' => 'elementor-control-align',
)
);
$this->add_control(
'heading_link_tags_styles',
array(
'label' => esc_html__( 'Link', 'jet-woo-builder' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
)
);
$this->add_group_control(
Group_Control_Typography::get_type(),
array(
'name' => 'tags_link_typography',
'selector' => '{{WRAPPER}} ' . $css_scheme['tags_link'],
)
);
$this->start_controls_tabs( 'tabs_tags_link_style' );
$this->start_controls_tab(
'tab_tags_link_normal',
array(
'label' => esc_html__( 'Normal', 'jet-woo-builder' ),
)
);
$this->add_control(
'tags_link_color',
array(
'label' => esc_html__( 'Color', 'jet-woo-builder' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['tags_link'] => 'color: {{VALUE}}',
),
)
);
$this->end_controls_tab();
$this->start_controls_tab(
'tab_tags_link_hover',
array(
'label' => esc_html__( 'Hover', 'jet-woo-builder' ),
)
);
$this->add_control(
'tags_link_hover_color',
array(
'label' => esc_html__( 'Color', 'jet-woo-builder' ),
'type' => Controls_Manager::COLOR,
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['tags_link'] . ':hover' => 'color: {{VALUE}}',
),
)
);
$this->add_control(
'tags_link_hover_decoration',
array(
'label' => esc_html__( 'Text Decoration', 'jet-woo-builder' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => array(
'none' => esc_html__( 'None', 'jet-woo-builder' ),
'line-through' => esc_html__( 'Line Through', 'jet-woo-builder' ),
'underline' => esc_html__( 'Underline', 'jet-woo-builder' ),
),
'selectors' => array(
'{{WRAPPER}} ' . $css_scheme['tags_link'] . ':hover' => 'text-decoration: {{VALUE}}',
),
)
);
$this->end_controls_tab();
$this->end_controls_tabs();
$this->end_controls_section();
}
protected function render() {
$this->__context = 'render';
global $product;
$product = wc_get_product();
if ( empty( $product ) ) {
return;
}
if ( true === $this->__set_editor_product() ) {
$this->__open_wrap();
include $this->__get_global_template( 'index' );
$this->__close_wrap();
$this->__reset_editor_product();
}
}
}