| @@ -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,42 @@ | ||
| 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 | + placeholder = view.getControlPlaceholder(); | |
| 108 | + if ( _.isObject( placeholder ) ) { | |
| 109 | + if ( ! _.isUndefined( placeholder.<?php | |
| 117 | 110 | // PHPCS - the variable $dimension_key is a plain text. |
| 118 | 111 | echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 119 | 112 | ?> ) ) { |
| 120 | - print( encodeURIComponent( placeholder.<?php | |
| 113 | + print( placeholder.<?php | |
| 121 | 114 | // PHPCS - the variable $dimension_key is a plain text. |
| 122 | 115 | echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 123 | - ?> ) ); | |
| 124 | - } else { | |
| 125 | - print( placeholder ? encodeURIComponent( placeholder ) : '' ); | |
| 126 | - } #>" | |
| 116 | + ?> ); | |
| 117 | + } | |
| 118 | + } else { | |
| 119 | + print( placeholder ); | |
| 120 | + } #>" | |
| 127 | 121 | <# if ( -1 === _.indexOf( allowed_dimensions, '<?php |
| 128 | 122 | // PHPCS - the variable $dimension_key is a plain text. |
| 129 | 123 | echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 130 | 124 | ?>' ) ) { #> |
| @@ -130,9 +124,9 @@ | ||
| 130 | 124 | ?>' ) ) { #> |
| 131 | 125 | disabled |
| 132 | 126 | <# } #> |
| 133 | 127 | /> |
| 134 | - <label for="<?php $this->print_control_uid( $dimension_key ); ?>" class="elementor-control-<?php echo esc_attr( $class_name ); ?>-label"><?php | |
| 128 | + <label for="<?php $this->print_control_uid( $dimension_key ); ?>" class="elementor-control-dimension-label"><?php | |
| 135 | 129 | // PHPCS - the variable $dimension_title holds an escaped translated value. |
| 136 | 130 | echo $dimension_title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 137 | 131 | ?></label> |
| 138 | 132 | </li> |
| @@ -137,9 +131,9 @@ | ||
| 137 | 131 | ?></label> |
| 138 | 132 | </li> |
| 139 | 133 | <?php endforeach; ?> |
| 140 | 134 | <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' ); ?>"> | |
| 135 | + <button class="elementor-link-dimensions tooltip-target" data-tooltip="<?php echo esc_attr__( 'Link values together', 'elementor' ); ?>"> | |
| 142 | 136 | <span class="elementor-linked"> |
| 143 | 137 | <i class="eicon-link" aria-hidden="true"></i> |
| 144 | 138 | <span class="elementor-screen-only"><?php echo esc_html__( 'Link values together', 'elementor' ); ?></span> |
| 145 | 139 | </span> |