textarea.php (1987B)
1 <?php 2 namespace Elementor; 3 4 use Elementor\Modules\DynamicTags\Module as TagsModule; 5 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; // Exit if accessed directly. 8 } 9 10 /** 11 * Elementor textarea control. 12 * 13 * A base control for creating textarea control. Displays a classic textarea. 14 * 15 * @since 1.0.0 16 */ 17 class Control_Textarea extends Base_Data_Control { 18 19 /** 20 * Get textarea control type. 21 * 22 * Retrieve the control type, in this case `textarea`. 23 * 24 * @since 1.0.0 25 * @access public 26 * 27 * @return string Control type. 28 */ 29 public function get_type() { 30 return 'textarea'; 31 } 32 33 /** 34 * Get textarea control default settings. 35 * 36 * Retrieve the default settings of the textarea control. Used to return the 37 * default settings while initializing the textarea control. 38 * 39 * @since 1.0.0 40 * @access protected 41 * 42 * @return array Control default settings. 43 */ 44 protected function get_default_settings() { 45 return [ 46 'label_block' => true, 47 'rows' => 5, 48 'placeholder' => '', 49 'dynamic' => [ 50 'categories' => [ TagsModule::TEXT_CATEGORY ], 51 ], 52 ]; 53 } 54 55 /** 56 * Render textarea control output in the editor. 57 * 58 * Used to generate the control HTML in the editor using Underscore JS 59 * template. The variables for the class are available using `data` JS 60 * object. 61 * 62 * @since 1.0.0 63 * @access public 64 */ 65 public function content_template() { 66 ?> 67 <div class="elementor-control-field"> 68 <label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label> 69 <div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper"> 70 <textarea id="<?php $this->print_control_uid(); ?>" class="elementor-control-tag-area" rows="{{ data.rows }}" data-setting="{{ data.name }}" placeholder="{{ view.getControlPlaceholder() }}"></textarea> 71 </div> 72 </div> 73 <# if ( data.description ) { #> 74 <div class="elementor-control-field-description">{{{ data.description }}}</div> 75 <# } #> 76 <?php 77 } 78 }