PluginProbe
MotoPress Hotel Booking for Divi / 1.1.0
MotoPress Hotel Booking for Divi v1.1.0
trunk 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 2.0.0
mphb-divi / includes / modules / accommodation / price / price.php

price.php in MotoPress Hotel Booking for Divi 1.1.0, at includes/modules/accommodation/price/price.php

41 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use MPHB\Views\SingleRoomTypeView;
4
5 class MPHB_Divi_Accommodation_Type_Price_Module extends MPHB_Divi_Abstract_Accommodation_Module {
6
7 public $slug = 'mphb-divi-accommodation-type-price';
8
9 public function init() {
10 $this->name = esc_html__( 'HB Acc. Type Price', 'mphb-divi' );
11 }
12
13 public static function get_html($attrs = array()) {
14
15 $current_room_type = MPHB()->getCurrentRoomType();
16
17 $id = isset( $attrs['accommodation_id'] ) && $attrs['accommodation_id'] !== 'current' ? (int) $attrs['accommodation_id'] : self::get_current_post_id();
18
19 if ( 'mphb_room_type' != get_post_type( $id ) ) {
20 return '';
21 }
22
23 MPHB()->setCurrentRoomType( $id );
24
25 $price_HTML = '';
26 ob_start();
27
28 SingleRoomTypeView::renderDefaultOrForDatesPrice();
29
30 $price_HTML = ob_get_clean();
31
32 MPHB()->setCurrentRoomType($current_room_type ? $current_room_type->getId() : self::get_current_post_id());
33
34 return $price_HTML;
35 }
36
37 }
38
39 new MPHB_Divi_Accommodation_Type_Price_Module();
40
41