config.php
88 lines
| 1 | <?php |
| 2 | namespace ShopPress\Elementor\Widgets; |
| 3 | |
| 4 | use ShopPress\Elementor\ShopPressWidgets; |
| 5 | use Elementor\Controls_Manager; |
| 6 | |
| 7 | defined( 'ABSPATH' ) || exit; |
| 8 | |
| 9 | class Breadcrumb extends ShopPressWidgets { |
| 10 | |
| 11 | public function get_name() { |
| 12 | return 'sp-breadcrumb'; |
| 13 | } |
| 14 | |
| 15 | public function get_title() { |
| 16 | return __( 'Product Breadcrumb', 'shop-press' ); |
| 17 | } |
| 18 | |
| 19 | public function get_icon() { |
| 20 | return 'sp-widget sp-eicon-product-breadcrumbs'; |
| 21 | } |
| 22 | |
| 23 | public function get_categories() { |
| 24 | return array( 'sp_woo_single' ); |
| 25 | } |
| 26 | |
| 27 | public function setup_styling_options() { |
| 28 | |
| 29 | $this->register_group_styler( |
| 30 | 'wrapper', |
| 31 | __( 'Wrapper', 'shop-press' ), |
| 32 | array( |
| 33 | 'wrapper' => array( |
| 34 | 'label' => esc_html__( 'Wrapper', 'shop-press' ), |
| 35 | 'type' => 'styler', |
| 36 | 'selector' => '.sp-breadcrumbs-wrapper', |
| 37 | 'wrapper' => '{{WRAPPER}}', |
| 38 | ), |
| 39 | 'container' => array( |
| 40 | 'label' => esc_html__( 'Container', 'shop-press' ), |
| 41 | 'type' => 'styler', |
| 42 | 'selector' => '.sp-breadcrumbs', |
| 43 | 'wrapper' => '{{WRAPPER}} .sp-breadcrumbs-wrapper', |
| 44 | ), |
| 45 | ) |
| 46 | ); |
| 47 | |
| 48 | $this->register_group_styler( |
| 49 | 'breadcrumb', |
| 50 | __( 'Breadcrumb', 'shop-press' ), |
| 51 | array( |
| 52 | 'breadcrumb' => array( |
| 53 | 'label' => esc_html__( 'Breadcrumb', 'shop-press' ), |
| 54 | 'type' => 'styler', |
| 55 | 'selector' => 'nav.woocommerce-breadcrumb', |
| 56 | 'wrapper' => '{{WRAPPER}} .sp-breadcrumbs', |
| 57 | ), |
| 58 | 'breadcrumb_link' => array( |
| 59 | 'label' => esc_html__( 'Link', 'shop-press' ), |
| 60 | 'type' => 'styler', |
| 61 | 'selector' => 'a', |
| 62 | 'wrapper' => '{{WRAPPER}} .sp-breadcrumbs nav.woocommerce-breadcrumb', |
| 63 | ), |
| 64 | 'breadcrumb_product_name' => array( |
| 65 | 'label' => esc_html__( 'Product Name', 'shop-press' ), |
| 66 | 'type' => 'styler', |
| 67 | 'selector' => 'span', |
| 68 | 'wrapper' => '{{WRAPPER}} .sp-breadcrumbs nav.woocommerce-breadcrumb', |
| 69 | ), |
| 70 | ) |
| 71 | ); |
| 72 | } |
| 73 | |
| 74 | protected function register_controls() { |
| 75 | $this->setup_styling_options(); |
| 76 | |
| 77 | do_action( 'shoppress/elementor/widget/register_controls_init', $this ); |
| 78 | } |
| 79 | |
| 80 | protected function render() { |
| 81 | do_action( 'shoppress/widget/before_render', $this->get_settings_for_display() ); |
| 82 | |
| 83 | if ( $this->editor_preview() ) { |
| 84 | sp_load_builder_template( 'single-product/product-breadcrumb' ); |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 |