| 1 |
<?php |
| 2 |
namespace Elementor; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; // Exit if accessed directly. |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Elementor raw HTML control. |
| 10 |
* |
| 11 |
* A base control for creating raw HTML control. Displays HTML markup between |
| 12 |
* controls in the panel. |
| 13 |
* |
| 14 |
* @since 1.0.0 |
| 15 |
*/ |
| 16 |
class Control_Raw_Html extends Base_UI_Control { |
| 17 |
|
| 18 |
/** |
| 19 |
* Get raw html control type. |
| 20 |
* |
| 21 |
* Retrieve the control type, in this case `raw_html`. |
| 22 |
* |
| 23 |
* @since 1.0.0 |
| 24 |
* @access public |
| 25 |
* |
| 26 |
* @return string Control type. |
| 27 |
*/ |
| 28 |
public function get_type() { |
| 29 |
return 'raw_html'; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Render raw html control output in the editor. |
| 34 |
* |
| 35 |
* Used to generate the control HTML in the editor using Underscore JS |
| 36 |
* template. The variables for the class are available using `data` JS |
| 37 |
* object. |
| 38 |
* |
| 39 |
* @since 1.0.0 |
| 40 |
* @access public |
| 41 |
*/ |
| 42 |
public function content_template() { |
| 43 |
?> |
| 44 |
<# data.raw = elementor.compileTemplate( data.raw, { view } ); |
| 45 |
if ( data.label ) { #> |
| 46 |
<span class="elementor-control-title">{{{ data.label }}}</span> |
| 47 |
<# } #> |
| 48 |
<div class="elementor-control-raw-html {{ data.content_classes }}">{{{ data.raw }}}</div> |
| 49 |
<?php |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Get raw html control default settings. |
| 54 |
* |
| 55 |
* Retrieve the default settings of the raw html control. Used to return the |
| 56 |
* default settings while initializing the raw html control. |
| 57 |
* |
| 58 |
* @since 1.0.0 |
| 59 |
* @access protected |
| 60 |
* |
| 61 |
* @return array Control default settings. |
| 62 |
*/ |
| 63 |
protected function get_default_settings() { |
| 64 |
return [ |
| 65 |
'raw' => '', |
| 66 |
'content_classes' => '', |
| 67 |
]; |
| 68 |
} |
| 69 |
} |
| 70 |
|