PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.3.27
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.3.27
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
fluent-cart / app / Modules / Templating / Bricks / Elements / ProductContent.php

ProductContent.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.3.27, at app/Modules/Templating/Bricks/Elements/ProductContent.php

65 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Modules\Templating\Bricks\Elements;
4
5 use Bricks\Element;
6 use Bricks\Helpers;
7 use FluentCart\App\CPT\FluentProducts;
8 use FluentCart\App\Services\URL;
9
10 class ProductContent extends Element
11 {
12 public $category = 'fluent_cart_product';
13 public $name = 'fct-product-content';
14 public $icon = 'ti-wordpress';
15
16 public function get_label()
17 {
18 return esc_html__('Product content', 'fluent-cart');
19 }
20
21 public function set_controls()
22 {
23 $edit_link = Helpers::get_preview_post_link( get_the_ID() );
24 $label = esc_html__('Edit product content in FluentCart.', 'fluent-cart');
25
26 $this->controls['info'] = [
27 'tab' => 'content',
28 'type' => 'info',
29 'content' => $edit_link ? '<a href="' . esc_url($edit_link) . '" target="_blank">' . $label . '</a>' : $label,
30 ];
31 }
32
33 public function render()
34 {
35 $settings = $this->settings;
36
37 $product = get_post($this->post_id);
38
39 if (empty($product) || $product->post_type !== FluentProducts::CPT_NAME) {
40 return $this->render_element_placeholder(
41 [
42 'title' => esc_html__('For better preview select content to show.', 'fluent-cart'),
43 'description' => esc_html__('Go to: Settings > Template Settings > Populate Content', 'fluent-cart'),
44 ]
45 );
46 }
47
48 $content = get_post_field('post_content', $this->post_id);
49
50 if (!$content) {
51 return $this->render_element_placeholder(
52 [
53 'title' => esc_html__('Product content is empty.', 'fluent-cart'),
54 ]
55 );
56 }
57
58 $content = $this->render_dynamic_data($content);
59 $content = Helpers::parse_editor_content($content);
60 $content = str_replace(']]>', ']]&gt;', $content);
61
62 echo "<div {$this->render_attributes( '_root' )}>" . wp_kses_post($content) . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- render_attributes() handles escaping
63 }
64 }
65