PluginProbe
Property Hive / 2.2.5
Property Hive v2.2.5
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-floorplans-link.php

property-floorplans-link.php in Property Hive 2.2.5, at includes/bricks-builder-widgets/property-floorplans-link.php

89 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 * Bricks Builder Property Floorplans Link Widget.
4 *
5 * @since 1.0.0
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
10 class Bricks_Builder_Property_Floorplans_Link_Widget extends \Bricks\Element {
11
12 // Element properties
13 public $category = 'propertyhive';
14 public $name = 'bricks-builder-property-floorplans-link';
15 public $icon = 'fas fa-ruler-combined';
16
17 public function get_label()
18 {
19 return esc_html__( 'Floorplans Link', '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['height'] = [
33 'tab' => 'content',
34 //'group' => 'settings',
35 'label' => esc_html__( 'Height', 'propertyhive' ),
36 'type' => 'number',
37 'default' => 400
38 ];*/
39 }
40
41 public function render()
42 {
43 global $property;
44
45 if ( !isset($property->id) )
46 {
47 return;
48 }
49
50 $root_classes[] = $this->name;
51
52 // Add 'class' attribute to element root tag
53 $this->set_attribute( '_root', 'class', $root_classes );
54
55 echo "<div {$this->render_attributes( '_root' )}>";
56
57 if ( get_option('propertyhive_floorplans_stored_as', '') == 'urls' )
58 {
59 $floorplan_urls = $property->floorplan_urls;
60 if ( !is_array($floorplan_urls) ) { $floorplan_urls = array(); }
61
62 if ( !empty($floorplan_urls) )
63 {
64 $i = 0;
65 foreach ( $floorplan_urls as $floorplan )
66 {
67 echo '<a' . ( $i > 0 ? ' style="display:none"' : '' ) . ' href="' . esc_url($floorplan['url']) . '" data-fancybox="floorplans" rel="nofollow">' . esc_html( ( count($floorplan_urls) > 1 ? __( 'Floorplans', 'propertyhive' ) : __( 'Floorplan', 'propertyhive' ) ) ) . '</a>';
68 ++$i;
69 }
70 }
71 }
72 else
73 {
74 $floorplan_attachment_ids = $property->get_floorplan_attachment_ids();
75
76 if ( !empty($floorplan_attachment_ids) )
77 {
78 $i = 0;
79 foreach ( $floorplan_attachment_ids as $attachment_id )
80 {
81 echo '<a' . ( $i > 0 ? ' style="display:none"' : '' ) . ' href="' . esc_url(wp_get_attachment_url($attachment_id)) . '" data-fancybox="floorplans" rel="nofollow">' . esc_html( ( count($floorplan_attachment_ids) > 1 ? __( 'Floorplans', 'propertyhive' ) : __( 'Floorplan', 'propertyhive' ) ) ) . '</a>';
82 ++$i;
83 }
84 }
85 }
86
87 echo '</div>';
88 }
89 }