balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

button.php (1718B)


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