| 1 |
<?php |
| 2 |
|
| 3 |
class MPHB_Divi_Accommodation_Type_Featured_Image_Module extends MPHB_Divi_Abstract_Accommodation_Module { |
| 4 |
|
| 5 |
public $slug = 'mphb-divi-accommodation-type-featured-image'; |
| 6 |
|
| 7 |
public function init() { |
| 8 |
$this->name = esc_html__( 'HB Acc. Type Featured Image', 'mphb-divi' ); |
| 9 |
} |
| 10 |
|
| 11 |
public function mphb_get_fields() { |
| 12 |
return array( |
| 13 |
'link_to_post' => array( |
| 14 |
'label' => esc_html__( 'Link to post', 'mphb-divi' ), |
| 15 |
'type' => 'yes_no_button', |
| 16 |
'options' => array( |
| 17 |
'on' => esc_html__( 'Yes', 'mphb-divi' ), |
| 18 |
'off' => esc_html__( 'No', 'mphb-divi' ), |
| 19 |
), |
| 20 |
'default' => 'off', |
| 21 |
'computed_affects' => array( |
| 22 |
'__html', |
| 23 |
), |
| 24 |
), |
| 25 |
'image_size' => array( |
| 26 |
'label' => esc_html__( 'Image size', 'mphb-divi' ), |
| 27 |
'type' => 'select', |
| 28 |
'options' => $this->get_image_sizes_select(), |
| 29 |
'default' => 'large', |
| 30 |
'computed_affects' => array( |
| 31 |
'__html', |
| 32 |
), |
| 33 |
), |
| 34 |
); |
| 35 |
} |
| 36 |
|
| 37 |
public function mphb_render_depends_on() { |
| 38 |
return array( 'link_to_post', 'image_size' ); |
| 39 |
} |
| 40 |
|
| 41 |
public static function get_html( $attrs = array() ) { |
| 42 |
return MPHB_Divi_Renderers::accommodation_featured_image( $attrs ); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
new MPHB_Divi_Accommodation_Type_Featured_Image_Module(); |
| 47 |
|