| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Elementor WPBC_Elementor_Go_Button_Control control. |
| 5 |
* |
| 6 |
* A control for displaying Go Button. |
| 7 |
* |
| 8 |
* @since 1.0.0 |
| 9 |
*/ |
| 10 |
class WPBC_Elementor_Go_Button_Control extends \Elementor\Base_Data_Control { |
| 11 |
|
| 12 |
/** |
| 13 |
* Get wpbc_go_button control type. |
| 14 |
* |
| 15 |
* Retrieve the control type, in this case `go_form_field`. |
| 16 |
* |
| 17 |
* @return string Control type. |
| 18 |
* @since 1.0.0 |
| 19 |
* @access public |
| 20 |
*/ |
| 21 |
public function get_type(): string { |
| 22 |
return 'wpbc_go_button'; |
| 23 |
} |
| 24 |
|
| 25 |
|
| 26 |
/** |
| 27 |
* Render go_form_field control output in the editor. |
| 28 |
* |
| 29 |
* Used to generate the control HTML in the editor using Underscore JS |
| 30 |
* template. The variables for the class are available using `data` JS |
| 31 |
* object. |
| 32 |
* |
| 33 |
* @since 1.0.0 |
| 34 |
* @access public |
| 35 |
*/ |
| 36 |
public function content_template(): void { |
| 37 |
$control_uid = $this->get_control_uid(); |
| 38 |
?> |
| 39 |
<div class="elementor-control-field elementor-control-button"> |
| 40 |
<div class="elementor-button-wrapper"> |
| 41 |
<button |
| 42 |
class="elementor-button <# if ( data.css_class ) { #>{{{data.css_class}}}<# } #>" |
| 43 |
type="button" |
| 44 |
<# if ( data.url ) { #> |
| 45 |
onclick="javascript:window.location.href ='{{{data.url}}}';" |
| 46 |
<# } #> |
| 47 |
><# if ( data.icon ) { #> |
| 48 |
<span>{{{ data.text }}}</span> |
| 49 |
<# } |
| 50 |
if ( data.icon ) { #> |
| 51 |
<i class="{{{ data.icon }}}" aria-hidden="true"></i> |
| 52 |
<# } #></button> |
| 53 |
</div> |
| 54 |
</div> |
| 55 |
|
| 56 |
<# if ( data.description ) { #> |
| 57 |
<div class="elementor-control-field-description">{{{ data.description }}}</div> |
| 58 |
<# } #> |
| 59 |
<?php |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
|