| 1 |
<?php |
| 2 |
/** |
| 3 |
* Main ProductDescription class. |
| 4 |
* |
| 5 |
* @package RadiusTheme\SB |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace RadiusTheme\SB\Elementor\Widgets\General; |
| 9 |
|
| 10 |
use RadiusTheme\SB\Helpers\Fns; |
| 11 |
use RadiusTheme\SB\Abstracts\ElementorWidgetBase; |
| 12 |
use RadiusTheme\SB\Elementor\Widgets\Controls\BreadcrumbsSettings; |
| 13 |
use RadiusTheme\SB\Helpers\BuilderFns; |
| 14 |
|
| 15 |
// Do not allow directly accessing this file. |
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
exit( 'This script cannot be accessed directly.' ); |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Product Description class |
| 22 |
*/ |
| 23 |
class ProductBreadcrumbs extends ElementorWidgetBase { |
| 24 |
/** |
| 25 |
* Construct function |
| 26 |
* |
| 27 |
* @param array $data default array. |
| 28 |
* @param mixed $args default arg. |
| 29 |
*/ |
| 30 |
public function __construct( $data = [], $args = null ) { |
| 31 |
$this->rtsb_name = esc_html__( 'Breadcrumbs', 'shopbuilder' ); |
| 32 |
$this->rtsb_base = 'rtsb-product-breadcrumbs'; |
| 33 |
parent::__construct( $data, $args ); |
| 34 |
$this->rtsb_category = 'rtsb-shopbuilder-general'; |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Widget Field |
| 39 |
* |
| 40 |
* @return array |
| 41 |
*/ |
| 42 |
public function widget_fields() { |
| 43 |
return BreadcrumbsSettings::widget_fields( $this ); |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Render Function |
| 48 |
* |
| 49 |
* @return void |
| 50 |
*/ |
| 51 |
protected function render() { |
| 52 |
global $post; |
| 53 |
|
| 54 |
$_post = $post; |
| 55 |
$controllers = $this->get_settings_for_display(); |
| 56 |
$this->theme_support(); |
| 57 |
$controllers['breadcrumbs_icon'] = Fns::icons_manager( $controllers['breadcrumbs_icon'] ); |
| 58 |
$args = [ |
| 59 |
'delimiter' => ! empty( $controllers['breadcrumbs_icon'] ) ? '<span class="breadcrumb-separator">' . $controllers['breadcrumbs_icon'] . '</span>' : '<span class="breadcrumb-separator"> / </span>', |
| 60 |
'wrap_before' => '<nav class="woocommerce-breadcrumb">', |
| 61 |
'wrap_after' => '</nav>', |
| 62 |
]; |
| 63 |
$data = [ |
| 64 |
'template' => 'elementor/general/breadcrumbs', |
| 65 |
'controllers' => $controllers, |
| 66 |
'args' => $args, |
| 67 |
]; |
| 68 |
|
| 69 |
if ( BuilderFns::is_builder_preview() ) { |
| 70 |
// Overriding Global. |
| 71 |
$post = get_post( Fns::get_prepared_product_id() ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 72 |
} |
| 73 |
|
| 74 |
Fns::load_template( $data['template'], $data ); |
| 75 |
$this->theme_support( 'render_reset' ); |
| 76 |
$post = $_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 77 |
} |
| 78 |
} |
| 79 |
|