PluginProbe
Property Hive / 2.3.0
Property Hive v2.3.0
2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 1.4.62 All 260 releases
propertyhive / includes / bricks-builder-widgets / property-type.php

property-type.php in Property Hive 2.3.0, at includes/bricks-builder-widgets/property-type.php

99 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Bricks Builder Property Type Widget.
4 *
5 * @since 1.0.0
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
10 class Bricks_Builder_Property_Type_Widget extends \Bricks\Element {
11
12 // Element properties
13 public $category = 'propertyhive';
14 public $name = 'bricks-builder-property-type';
15 public $icon = 'fas fa-tag';
16
17 public function get_label()
18 {
19 return esc_html__( 'Property Type', 'propertyhive' );
20 }
21
22 public function set_control_groups()
23 {
24 /*$this->control_groups['form'] = [
25 'title' => esc_html__( 'Form', 'propertyhive' ),
26 'tab' => 'content', // content / style
27 ];*/
28 }
29
30 public function set_controls()
31 {
32 $this->controls['icon'] = [
33 'tab' => 'content',
34 //'group' => 'settings',
35 'label' => esc_html__( 'Icon', 'propertyhive' ),
36 'type' => 'icon',
37 ];
38
39 $this->controls['before'] = [
40 'tab' => 'content',
41 //'group' => 'settings',
42 'label' => esc_html__( 'Before', 'propertyhive' ),
43 'type' => 'text',
44 'default' => __( 'Type:', 'propertyhive' ),
45 ];
46
47 $this->controls['after'] = [
48 'tab' => 'content',
49 //'group' => 'settings',
50 'label' => esc_html__( 'After', 'propertyhive' ),
51 'type' => 'text',
52 ];
53 }
54
55 public function render()
56 {
57 global $property;
58
59 if ( !isset($property->id) )
60 {
61 return;
62 }
63
64 if ( $property->property_type == '' )
65 {
66 return;
67 }
68
69 $root_classes[] = $this->name;
70
71 // Add 'class' attribute to element root tag
72 $this->set_attribute( '_root', 'class', $root_classes );
73
74 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Bricks serializes registered attributes through its documented render_attributes() API.
75 echo "<div {$this->render_attributes( '_root' )}>";
76
77 if ( isset( $this->settings['icon'] ) )
78 {
79 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Bricks Element::render_icon() returns the icon-control HTML fragment, including i/svg markup; Bricks sanitizes uploaded SVGs at its documented upload boundary.
80 echo self::render_icon( $this->settings['icon'] );
81 echo ' ';
82 }
83
84 if ( isset($this->settings['before']) && !empty($this->settings['before']) )
85 {
86 echo wp_kses_post( $this->settings['before'] ) . ' ';
87 }
88
89 echo esc_html($property->property_type);
90
91 if ( isset($this->settings['after']) && !empty($this->settings['after']) )
92 {
93 echo ' ' . wp_kses_post( $this->settings['after'] );
94 }
95
96 echo '</div>';
97 }
98 }
99