| 1 |
<?php |
| 2 |
|
| 3 |
use MPHB\Views\LoopRoomTypeView; |
| 4 |
use MPHB\Views\SingleRoomTypeView; |
| 5 |
|
| 6 |
class MPHB_Divi_Accommodation_Type_Gallery_Module extends MPHB_Divi_Abstract_Accommodation_Module { |
| 7 |
|
| 8 |
public $slug = 'mphb-divi-accommodation-type-gallery'; |
| 9 |
|
| 10 |
public function init() { |
| 11 |
$this->name = esc_html__( 'HB Acc. Type Gallery', 'mphb-divi' ); |
| 12 |
} |
| 13 |
|
| 14 |
public function mphb_get_fields() { |
| 15 |
return array( |
| 16 |
'image_size' => array( |
| 17 |
'label' => esc_html__( 'Image size', 'mphb-divi' ), |
| 18 |
'type' => 'select', |
| 19 |
'options' => $this->get_image_sizes_select(), |
| 20 |
'computed_affects' => array( |
| 21 |
'__html', |
| 22 |
), |
| 23 |
), |
| 24 |
'is_slider' => array( |
| 25 |
'label' => esc_html__( 'Display as slider', 'mphb-divi' ), |
| 26 |
'description' => esc_html__( 'Check it out on the frontend once applied.', 'mphb-divi' ), |
| 27 |
'type' => 'yes_no_button', |
| 28 |
'options' => array( |
| 29 |
'on' => esc_html__( 'Yes', 'mphb-divi' ), |
| 30 |
'off' => esc_html__( 'No', 'mphb-divi' ), |
| 31 |
), |
| 32 |
'default' => 'off', |
| 33 |
'computed_affects' => array( |
| 34 |
'__html', |
| 35 |
), |
| 36 |
), |
| 37 |
'columns' => array( |
| 38 |
'label' => esc_html__( 'Columns', 'mphb-divi' ), |
| 39 |
'type' => 'range', |
| 40 |
'default' => '4', |
| 41 |
'range_settings' => array( |
| 42 |
'min' => '1', |
| 43 |
'max' => '9', |
| 44 |
'step' => '1', |
| 45 |
), |
| 46 |
'computed_affects' => array( |
| 47 |
'__html', |
| 48 |
), |
| 49 |
), |
| 50 |
'link_to' => array( |
| 51 |
'label' => esc_html__( 'Link to', 'mphb-divi' ), |
| 52 |
'type' => 'select', |
| 53 |
'options' => array( |
| 54 |
'' => esc_html__( 'Default', 'mphb-divi' ), |
| 55 |
'none' => esc_html__( 'None', 'mphb-divi' ), |
| 56 |
'file' => esc_html__( 'File', 'mphb-divi' ), |
| 57 |
), |
| 58 |
'computed_affects' => array( |
| 59 |
'__html', |
| 60 |
), |
| 61 |
), |
| 62 |
'is_lightbox' => array( |
| 63 |
'label' => esc_html__( 'Open in lightbox', 'mphb-divi' ), |
| 64 |
'type' => 'yes_no_button', |
| 65 |
'options' => array( |
| 66 |
'on' => esc_html__( 'Yes', 'mphb-divi' ), |
| 67 |
'off' => esc_html__( 'No', 'mphb-divi' ), |
| 68 |
), |
| 69 |
'default' => 'off', |
| 70 |
'computed_affects' => array( |
| 71 |
'__html', |
| 72 |
), |
| 73 |
), |
| 74 |
); |
| 75 |
} |
| 76 |
|
| 77 |
public function mphb_render_depends_on() { |
| 78 |
return array( 'columns', 'image_size', 'link_to', 'is_lightbox' ); |
| 79 |
} |
| 80 |
|
| 81 |
public static function get_html( $attrs = array() ) { |
| 82 |
return MPHB_Divi_Renderers::accommodation_gallery( $attrs ); |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
new MPHB_Divi_Accommodation_Type_Gallery_Module(); |
| 87 |
|