PluginProbe
Property Hive / 2.3.0
Property Hive v2.3.0
2.3.1 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 All 261 releases
propertyhive / includes / bricks-builder-widgets / property-search-form.php

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

65 lines 2.0 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 Search Form Widget.
4 *
5 * @since 1.0.0
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
10 class Bricks_Builder_Property_Search_Form_Widget extends \Bricks\Element {
11
12 // Element properties
13 public $category = 'propertyhive';
14 public $name = 'bricks-builder-property-search-form';
15 public $icon = 'fas fa-magnifying-glass';
16 public $scripts = ['toggleDepartmentFields'];
17
18 public function get_label()
19 {
20 return esc_html__( 'Search Form', 'propertyhive' );
21 }
22
23 // Enqueue element styles and scripts
24 public function enqueue_scripts()
25 {
26 $suffix = '';
27 $assets_path = str_replace( array( 'http:', 'https:' ), '', PH()->plugin_url() ) . '/assets/';
28 $frontend_script_path = $assets_path . 'js/frontend/';
29
30 wp_enqueue_script( 'propertyhive_search', $frontend_script_path . 'search' . $suffix . '.js', array( 'jquery' ), PH_VERSION, true );
31 }
32
33 public function set_control_groups()
34 {
35 /*$this->control_groups['form'] = [
36 'title' => esc_html__( 'Form', 'propertyhive' ),
37 'tab' => 'content', // content / style
38 ];*/
39 }
40
41 public function set_controls()
42 {
43 $this->controls['form_id'] = [ // Unique control identifier (lowercase, no spaces)
44 'tab' => 'content', // Control tab: content/style
45 //'group' => 'form', // Show under control group
46 'label' => esc_html__( 'Form ID', 'propertyhive' ), // Control label
47 'type' => 'text', // Control type
48 'default' => 'default', // Default setting
49 ];
50 }
51
52 public function render()
53 {
54 $root_classes[] = $this->name;
55
56 // Add 'class' attribute to element root tag
57 $this->set_attribute( '_root', 'class', $root_classes );
58
59 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Bricks serializes registered attributes through its documented render_attributes() API.
60 echo "<div {$this->render_attributes( '_root' )}>";
61 echo do_shortcode('[property_search_form id="' . $this->settings['form_id'] . '"]');
62 echo '</div>';
63 }
64 }
65