PluginProbe
Property Hive / 2.2.2
Property Hive v2.2.2
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 / salient-widgets / property-search-form.php

property-search-form.php in Property Hive 2.2.2, at includes/salient-widgets/property-search-form.php

85 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Salient Property Search Form Widget.
4 *
5 * @since 1.0.0
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
10 class Salient_Property_Search_Form_Widget {
11
12 public function __construct()
13 {
14 add_action('admin_head', array( $this, 'custom_wpbakery_element_icon' ), 999 );
15 add_action('vc_before_init', array( $this, 'custom_wpbakery_element' ) );
16 }
17
18 public function custom_wpbakery_element_icon()
19 {
20 echo '<style type="text/css">
21 .wpb_salient_property_search_form .vc_element-icon:before,
22 a[data-tag="salient_property_search_form"] .vc_element-icon:before {
23 font-family: "Dashicons" !important;
24 content: "\f179";
25 }
26 </style>';
27 }
28
29 public function custom_wpbakery_element()
30 {
31 $class_name = get_class($this);
32
33 $widget_dir = dirname(__FILE__);
34
35 $html_template = $widget_dir . '/' . str_replace("_", "-", str_replace(array( "salient_", "_widget" ), "", sanitize_title($class_name))) . '-html.php';
36
37 $description = '';
38 if ( class_exists('PH_Template_Assistant') )
39 {
40 $description = sprintf( __( 'Search forms can be managed from within \'<a href="%s" target="_blank">Property Hive > Settings > Template Assistant > Search Forms</a>\'', 'propertyhive' ), admin_url('/admin.php?page=ph-settings&tab=template-assistant&section=search-forms') );
41 }
42
43 $departments = ph_get_departments();
44
45 $department_options = array();
46
47 foreach ( $departments as $key => $value )
48 {
49 if ( get_option( 'propertyhive_active_departments_' . str_replace("residential-", "", $key) ) == 'yes' )
50 {
51 $department_options[$value] = $key;
52 }
53 }
54
55 vc_map( array(
56 "name" => __( 'Search Form', 'propertyhive' ),
57 "base" => "salient_property_search_form",
58 "class" => "",
59 "category" => __( "Property Hive", "propertyhive"),
60 "html_template" => $html_template,
61 "params" => array(
62 array(
63 "type" => "textfield",
64 "class" => "",
65 "heading" => __( 'Form ID', 'propertyhive' ),
66 "param_name" => "form_id",
67 "value" => 'default',
68 "description" => $description
69 ),
70 array(
71 "type" => "dropdown",
72 "class" => "",
73 "heading" => __( 'Default Department', 'propertyhive' ),
74 "param_name" => "default_department",
75 "value" => $department_options
76 ),
77 )
78 ));
79 }
80
81
82 }
83
84 new Salient_Property_Search_Form_Widget();
85