| @@ -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,57 +83,50 @@ | ||
| 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' => __( 'Top', 'elementor' ), | |
| 89 | + 'right' => __( 'Right', 'elementor' ), | |
| 90 | + 'bottom' => __( 'Bottom', 'elementor' ), | |
| 91 | + 'left' => __( '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 ) : | |
| 101 | + $control_uid = $this->get_control_uid( $dimension_key ); | |
| 109 | 102 | ?> |
| 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 | |
| 112 | - // PHPCS - the variable $dimension_key is a plain text. | |
| 113 | - echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 114 | - ?>" placeholder="<# | |
| 115 | - placeholder = view.getControlPlaceholder(); | |
| 116 | - if ( _.isObject( placeholder ) && ! _.isUndefined( placeholder.<?php | |
| 117 | - // PHPCS - the variable $dimension_key is a plain text. | |
| 118 | - echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 119 | - ?> ) ) { | |
| 120 | - print( encodeURIComponent( placeholder.<?php | |
| 121 | - // PHPCS - the variable $dimension_key is a plain text. | |
| 122 | - echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 123 | - ?> ) ); | |
| 124 | - } else { | |
| 125 | - print( placeholder ? encodeURIComponent( placeholder ) : '' ); | |
| 126 | - } #>" | |
| 127 | - <# if ( -1 === _.indexOf( allowed_dimensions, '<?php | |
| 128 | - // PHPCS - the variable $dimension_key is a plain text. | |
| 129 | - echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 130 | - ?>' ) ) { #> | |
| 103 | + <li class="elementor-control-dimension"> | |
| 104 | + <input id="<?php echo $control_uid; ?>" type="number" data-setting="<?php echo esc_attr( $dimension_key ); ?>" | |
| 105 | + placeholder="<# | |
| 106 | + if ( _.isObject( data.placeholder ) ) { | |
| 107 | + if ( ! _.isUndefined( data.placeholder.<?php echo $dimension_key; ?> ) ) { | |
| 108 | + print( data.placeholder.<?php echo $dimension_key; ?> ); | |
| 109 | + } | |
| 110 | + } else { | |
| 111 | + print( data.placeholder ); | |
| 112 | + } #>" | |
| 113 | + <# if ( -1 === _.indexOf( allowed_dimensions, '<?php echo $dimension_key; ?>' ) ) { #> | |
| 131 | 114 | disabled |
| 132 | 115 | <# } #> |
| 133 | 116 | /> |
| 134 | - <label for="<?php $this->print_control_uid( $dimension_key ); ?>" class="elementor-control-<?php echo esc_attr( $class_name ); ?>-label"><?php | |
| 135 | - // PHPCS - the variable $dimension_title holds an escaped translated value. | |
| 136 | - echo $dimension_title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 137 | - ?></label> | |
| 117 | + <label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-dimension-label"><?php echo $dimension_title; ?></label> | |
| 138 | 118 | </li> |
| 139 | 119 | <?php endforeach; ?> |
| 140 | 120 | <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' ); ?>"> | |
| 121 | + <button class="elementor-link-dimensions tooltip-target" data-tooltip="<?php echo esc_attr__( 'Link values together', 'elementor' ); ?>"> | |
| 142 | 122 | <span class="elementor-linked"> |
| 143 | 123 | <i class="eicon-link" aria-hidden="true"></i> |
| 144 | - <span class="elementor-screen-only"><?php echo esc_html__( 'Link values together', 'elementor' ); ?></span> | |
| 124 | + <span class="elementor-screen-only"><?php echo __( 'Link values together', 'elementor' ); ?></span> | |
| 145 | 125 | </span> |
| 146 | 126 | <span class="elementor-unlinked"> |
| 147 | 127 | <i class="eicon-chain-broken" aria-hidden="true"></i> |
| 148 | - <span class="elementor-screen-only"><?php echo esc_html__( 'Unlinked values', 'elementor' ); ?></span> | |
| 128 | + <span class="elementor-screen-only"><?php echo __( 'Unlinked values', 'elementor' ); ?></span> | |
| 149 | 129 | </span> |
| 150 | 130 | </button> |
| 151 | 131 | </li> |
| 152 | 132 | </ul> |