| @@ -51,12 +51,8 @@ | ||
| 51 | 51 | ] |
| 52 | 52 | ); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function get_singular_name() { | |
| 56 | - return 'dimension'; | |
| 57 | - } | |
| 58 | - | |
| 59 | 55 | /** |
| 60 | 56 | * Get dimensions control default settings. |
| 61 | 57 | * |
| 62 | 58 | * Retrieve the default settings of the dimensions control. Used to return the |
| @@ -76,17 +72,8 @@ | ||
| 76 | 72 | ] |
| 77 | 73 | ); |
| 78 | 74 | } |
| 79 | 75 | |
| 80 | - protected function get_dimensions() { | |
| 81 | - return [ | |
| 82 | - 'top' => __( 'Top', 'elementor' ), | |
| 83 | - 'right' => __( 'Right', 'elementor' ), | |
| 84 | - 'bottom' => __( 'Bottom', 'elementor' ), | |
| 85 | - 'left' => __( 'Left', 'elementor' ), | |
| 86 | - ]; | |
| 87 | - } | |
| 88 | - | |
| 89 | 76 | /** |
| 90 | 77 | * Render dimensions control output in the editor. |
| 91 | 78 | * |
| 92 | 79 | * Used to generate the control HTML in the editor using Underscore JS |
| @@ -96,35 +83,41 @@ | ||
| 96 | 83 | * @since 1.0.0 |
| 97 | 84 | * @access public |
| 98 | 85 | */ |
| 99 | 86 | public function content_template() { |
| 100 | - $class_name = $this->get_singular_name(); | |
| 87 | + $dimensions = [ | |
| 88 | + 'top' => esc_html__( 'Top', 'elementor' ), | |
| 89 | + 'right' => esc_html__( 'Right', 'elementor' ), | |
| 90 | + 'bottom' => esc_html__( 'Bottom', 'elementor' ), | |
| 91 | + 'left' => esc_html__( 'Left', 'elementor' ), | |
| 92 | + ]; | |
| 101 | 93 | ?> |
| 102 | 94 | <div class="elementor-control-field"> |
| 103 | 95 | <label class="elementor-control-title">{{{ data.label }}}</label> |
| 104 | 96 | <?php $this->print_units_template(); ?> |
| 105 | 97 | <div class="elementor-control-input-wrapper"> |
| 106 | - <ul class="elementor-control-<?php echo esc_attr( $class_name ); ?>s"> | |
| 98 | + <ul class="elementor-control-dimensions"> | |
| 107 | 99 | <?php |
| 108 | - foreach ( $this->get_dimensions() as $dimension_key => $dimension_title ) : | |
| 100 | + foreach ( $dimensions as $dimension_key => $dimension_title ) : | |
| 109 | 101 | ?> |
| 110 | - <li class="elementor-control-<?php echo esc_attr( $class_name ); ?>"> | |
| 111 | - <input id="<?php $this->print_control_uid( $dimension_key ); ?>" type="text" data-setting="<?php | |
| 102 | + <li class="elementor-control-dimension"> | |
| 103 | + <input id="<?php $this->print_control_uid( $dimension_key ); ?>" type="number" data-setting="<?php | |
| 112 | 104 | // PHPCS - the variable $dimension_key is a plain text. |
| 113 | 105 | echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 114 | 106 | ?>" placeholder="<# |
| 115 | - placeholder = view.getControlPlaceholder(); | |
| 116 | - if ( _.isObject( placeholder ) && ! _.isUndefined( placeholder.<?php | |
| 107 | + if ( _.isObject( data.placeholder ) ) { | |
| 108 | + if ( ! _.isUndefined( data.placeholder.<?php | |
| 117 | 109 | // PHPCS - the variable $dimension_key is a plain text. |
| 118 | 110 | echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 119 | 111 | ?> ) ) { |
| 120 | - print( encodeURIComponent( placeholder.<?php | |
| 112 | + print( data.placeholder.<?php | |
| 121 | 113 | // PHPCS - the variable $dimension_key is a plain text. |
| 122 | 114 | echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 123 | - ?> ) ); | |
| 124 | - } else { | |
| 125 | - print( placeholder ? encodeURIComponent( placeholder ) : '' ); | |
| 126 | - } #>" | |
| 115 | + ?> ); | |
| 116 | + } | |
| 117 | + } else { | |
| 118 | + print( data.placeholder ); | |
| 119 | + } #>" | |
| 127 | 120 | <# if ( -1 === _.indexOf( allowed_dimensions, '<?php |
| 128 | 121 | // PHPCS - the variable $dimension_key is a plain text. |
| 129 | 122 | echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 130 | 123 | ?>' ) ) { #> |
| @@ -130,9 +123,9 @@ | ||
| 130 | 123 | ?>' ) ) { #> |
| 131 | 124 | disabled |
| 132 | 125 | <# } #> |
| 133 | 126 | /> |
| 134 | - <label for="<?php $this->print_control_uid( $dimension_key ); ?>" class="elementor-control-<?php echo esc_attr( $class_name ); ?>-label"><?php | |
| 127 | + <label for="<?php $this->print_control_uid( $dimension_key ); ?>" class="elementor-control-dimension-label"><?php | |
| 135 | 128 | // PHPCS - the variable $dimension_title holds an escaped translated value. |
| 136 | 129 | echo $dimension_title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 137 | 130 | ?></label> |
| 138 | 131 | </li> |
| @@ -137,9 +130,9 @@ | ||
| 137 | 130 | ?></label> |
| 138 | 131 | </li> |
| 139 | 132 | <?php endforeach; ?> |
| 140 | 133 | <li> |
| 141 | - <button class="elementor-link-<?php echo esc_attr( $class_name ); ?>s tooltip-target" data-tooltip="<?php echo esc_attr__( 'Link values together', 'elementor' ); ?>"> | |
| 134 | + <button class="elementor-link-dimensions tooltip-target" data-tooltip="<?php echo esc_attr__( 'Link values together', 'elementor' ); ?>"> | |
| 142 | 135 | <span class="elementor-linked"> |
| 143 | 136 | <i class="eicon-link" aria-hidden="true"></i> |
| 144 | 137 | <span class="elementor-screen-only"><?php echo esc_html__( 'Link values together', 'elementor' ); ?></span> |
| 145 | 138 | </span> |