| 1 |
<?php |
| 2 |
// phpcs:disable PSR1.Methods.CamelCapsMethodName |
| 3 |
// phpcs:disable WordPressVIPMinimum.TemplatingEngines.UnescapedOutputMustache.OutputNotation |
| 4 |
|
| 5 |
namespace Beyondwords\Wordpress\Compatibility\Elementor\Controls; |
| 6 |
|
| 7 |
use Elementor\Base_Data_Control; |
| 8 |
use Elementor\Modules\DynamicTags\Module as TagsModule; |
| 9 |
|
| 10 |
/** |
| 11 |
* Inspect Textarea control. |
| 12 |
* |
| 13 |
* Similar to Elementor Textarea control, but with readonly fields. |
| 14 |
* |
| 15 |
* @codeCoverageIgnore |
| 16 |
* |
| 17 |
* @since 3.10.0 |
| 18 |
*/ |
| 19 |
class InspectTextarea extends Base_Data_Control |
| 20 |
{ |
| 21 |
/** |
| 22 |
* Get text control type. |
| 23 |
* |
| 24 |
* Retrieve the control type, in this case `text`. |
| 25 |
* |
| 26 |
* @since 3.10.0 |
| 27 |
* @access public |
| 28 |
* |
| 29 |
* @return string Control type. |
| 30 |
*/ |
| 31 |
public function get_type() |
| 32 |
{ |
| 33 |
return 'beyondwords_inspect_textarea'; |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Get text control default settings. |
| 38 |
* |
| 39 |
* Retrieve the default settings of the text control. Used to return the |
| 40 |
* default settings while initializing the text control. |
| 41 |
* |
| 42 |
* @since 3.10.0 |
| 43 |
* @access protected |
| 44 |
* |
| 45 |
* @return array Control default settings. |
| 46 |
*/ |
| 47 |
protected function get_default_settings() |
| 48 |
{ |
| 49 |
return [ |
| 50 |
'input_type' => 'text', |
| 51 |
'placeholder' => '', |
| 52 |
'title' => '', |
| 53 |
'dynamic' => [ |
| 54 |
'categories' => [ |
| 55 |
TagsModule::TEXT_CATEGORY, |
| 56 |
], |
| 57 |
], |
| 58 |
]; |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* Render text control output in the editor. |
| 63 |
* |
| 64 |
* Used to generate the control HTML in the editor using Underscore JS |
| 65 |
* template. The variables for the class are available using `data` JS |
| 66 |
* object. |
| 67 |
* |
| 68 |
* |
| 69 |
* |
| 70 |
* @since 3.10.0 |
| 71 |
* @access public |
| 72 |
*/ |
| 73 |
public function content_template() |
| 74 |
{ |
| 75 |
// phpcs:disable |
| 76 |
?> |
| 77 |
<div class="elementor-control-field"> |
| 78 |
<# if ( data.label ) {#> |
| 79 |
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label> |
| 80 |
<# } #> |
| 81 |
<div class="elementor-control-input-wrapper elementor-control-unit-5 elementor-control-dynamic-switcher-wrapper"> |
| 82 |
<input id="<?php $this->print_control_uid(); ?>" type="{{ data.type }}" disabled readonly class="tooltip-target elementor-control-tag-area" data-tooltip="{{ data.title }}" title="{{ data.title }}" data-setting="{{ data.name }}" placeholder="{{ view.getControlPlaceholder() }}" /> |
| 83 |
</div> |
| 84 |
</div> |
| 85 |
<# if ( data.description ) { #> |
| 86 |
<div class="elementor-control-field-description">{{{ data.description }}}</div> |
| 87 |
<# } #> |
| 88 |
<?php |
| 89 |
// phpcs:enable |
| 90 |
} |
| 91 |
} |
| 92 |
|