| @@ -16,9 +16,9 @@ | ||
| 16 | 16 | use Elementor\Plugin; |
| 17 | 17 | use Elementor\Repeater; |
| 18 | 18 | |
| 19 | 19 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | - exit; // Exit if accessed directly. | |
| 20 | + exit; // Exit if accessed directly | |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | class NestedTabs extends Widget_Nested_Base { |
| 24 | 24 | |
| @@ -57,13 +57,9 @@ | ||
| 57 | 57 | protected function tab_content_container( int $index ) { |
| 58 | 58 | return [ |
| 59 | 59 | 'elType' => 'container', |
| 60 | 60 | 'settings' => [ |
| 61 | - '_title' => sprintf( | |
| 62 | - /* translators: %d: Tab index. */ | |
| 63 | - __( 'Tab #%d', 'elementor' ), | |
| 64 | - $index | |
| 65 | - ), | |
| 61 | + '_title' => sprintf( __( 'Tab #%s', 'elementor' ), $index ), | |
| 66 | 62 | 'content_width' => 'full', |
| 67 | 63 | ], |
| 68 | 64 | ]; |
| 69 | 65 | } |
| @@ -80,9 +76,8 @@ | ||
| 80 | 76 | return 'tab_title'; |
| 81 | 77 | } |
| 82 | 78 | |
| 83 | 79 | protected function get_default_children_title() { |
| 84 | - /* translators: %d: Tab index. */ | |
| 85 | 80 | return esc_html__( 'Tab #%d', 'elementor' ); |
| 86 | 81 | } |
| 87 | 82 | |
| 88 | 83 | protected function get_default_children_placeholder_selector() { |
| @@ -1075,9 +1070,8 @@ | ||
| 1075 | 1070 | } |
| 1076 | 1071 | |
| 1077 | 1072 | $this->add_render_attribute( $setting_key, [ |
| 1078 | 1073 | 'id' => $item_settings['tab_id'], |
| 1079 | - 'data-tab-title-id' => $item_settings['tab_title_id'], | |
| 1080 | 1074 | 'class' => $css_classes, |
| 1081 | 1075 | 'aria-selected' => 1 === $item_settings['tab_count'] ? 'true' : 'false', |
| 1082 | 1076 | 'data-tab-index' => $item_settings['tab_count'], |
| 1083 | 1077 | 'role' => 'tab', |
| @@ -1123,9 +1117,9 @@ | ||
| 1123 | 1117 | |
| 1124 | 1118 | /** |
| 1125 | 1119 | * Print the content area. |
| 1126 | 1120 | * |
| 1127 | - * @param int $index | |
| 1121 | + * @param int $index | |
| 1128 | 1122 | * @param array $item_settings |
| 1129 | 1123 | */ |
| 1130 | 1124 | public function print_child( $index, $item_settings = [] ) { |
| 1131 | 1125 | $children = $this->get_children(); |
| @@ -1184,11 +1178,11 @@ | ||
| 1184 | 1178 | <div class="e-n-tabs-heading" role="tablist"> |
| 1185 | 1179 | <?php |
| 1186 | 1180 | foreach ( $settings['tabs'] as $index => $item ) { |
| 1187 | 1181 | $tab_count = $index + 1; |
| 1188 | - $tab_title_id = 'e-n-tab-title-' . $widget_number . $tab_count; | |
| 1182 | + | |
| 1189 | 1183 | $tab_id = empty( $item['element_id'] ) |
| 1190 | - ? $tab_title_id | |
| 1184 | + ? 'e-n-tab-title-' . $widget_number . $tab_count | |
| 1191 | 1185 | : $item['element_id']; |
| 1192 | 1186 | |
| 1193 | 1187 | $item_settings = [ |
| 1194 | 1188 | 'index' => $index, |
| @@ -1193,9 +1187,8 @@ | ||
| 1193 | 1187 | $item_settings = [ |
| 1194 | 1188 | 'index' => $index, |
| 1195 | 1189 | 'tab_count' => $tab_count, |
| 1196 | 1190 | 'tab_id' => $tab_id, |
| 1197 | - 'tab_title_id' => $tab_title_id, | |
| 1198 | 1191 | 'container_id' => 'e-n-tab-content-' . $widget_number . $tab_count, |
| 1199 | 1192 | 'widget_number' => $widget_number, |
| 1200 | 1193 | 'item' => $item, |
| 1201 | 1194 | 'settings' => $settings, |
| @@ -1261,12 +1254,11 @@ | ||
| 1261 | 1254 | private function content_template_single_item( $tab_index, $item, $element_uid, $hover_animation_class ) { |
| 1262 | 1255 | ?> |
| 1263 | 1256 | <# |
| 1264 | 1257 | const tabCount = tabIndex + 1, |
| 1265 | - tabTitleId = 'e-n-tab-title-' + elementUid + tabCount, | |
| 1266 | 1258 | tabId = item.element_id |
| 1267 | 1259 | ? item.element_id |
| 1268 | - : tabTitleId, | |
| 1260 | + : 'e-n-tab-title-' + elementUid + ( tabIndex + 1 ), | |
| 1269 | 1261 | tabUid = elementUid + tabCount, |
| 1270 | 1262 | tabIcon = elementor.helpers.renderIcon( view, item.tab_icon, { 'aria-hidden': true }, 'i' , 'object' ), |
| 1271 | 1263 | activeTabIcon = item.tab_icon_active.value |
| 1272 | 1264 | ? elementor.helpers.renderIcon( view, item.tab_icon_active, { 'aria-hidden': true }, 'i' , 'object' ) |
| @@ -1274,9 +1266,8 @@ | ||
| 1274 | 1266 | escapedHoverAnimationClass = _.escape( hoverAnimationClass ); |
| 1275 | 1267 | |
| 1276 | 1268 | view.addRenderAttribute( 'tab-title', { |
| 1277 | 1269 | 'id': tabId, |
| 1278 | - 'data-tab-title-id': tabTitleId, | |
| 1279 | 1270 | 'class': [ 'e-n-tab-title',escapedHoverAnimationClass ], |
| 1280 | 1271 | 'data-tab-index': tabCount, |
| 1281 | 1272 | 'role': 'tab', |
| 1282 | 1273 | 'aria-selected': 1 === tabCount ? 'true' : 'false', |
| @@ -1288,20 +1279,11 @@ | ||
| 1288 | 1279 | view.addRenderAttribute( 'tab-title-text', { |
| 1289 | 1280 | 'class': [ 'e-n-tab-title-text' ], |
| 1290 | 1281 | 'data-binding-type': 'repeater-item', |
| 1291 | 1282 | 'data-binding-repeater-name': 'tabs', |
| 1292 | - 'data-binding-setting': [ 'tab_title', 'element_id' ], | |
| 1283 | + 'data-binding-setting': [ 'tab_title' ], | |
| 1293 | 1284 | 'data-binding-index': tabCount, |
| 1294 | - 'data-binding-config': JSON.stringify({ | |
| 1295 | - 'element_id': { | |
| 1296 | - attr: 'id', | |
| 1297 | - selector: 'button', | |
| 1298 | - editType: 'attribute', | |
| 1299 | - }, | |
| 1300 | - 'tab_title': { | |
| 1301 | - editType: 'text', | |
| 1302 | - }, | |
| 1303 | - }), | |
| 1285 | + 'data-binding-dynamic': 'true', | |
| 1304 | 1286 | }, null, true ); |
| 1305 | 1287 | |
| 1306 | 1288 | view.addRenderAttribute( 'tab-icon', { |
| 1307 | 1289 | 'class': [ 'e-n-tab-icon' ], |
| @@ -1306,8 +1288,9 @@ | ||
| 1306 | 1288 | view.addRenderAttribute( 'tab-icon', { |
| 1307 | 1289 | 'class': [ 'e-n-tab-icon' ], |
| 1308 | 1290 | 'data-binding-type': 'repeater-item', |
| 1309 | 1291 | 'data-binding-repeater-name': 'tabs', |
| 1292 | + 'data-binding-setting': [ 'tab_icon', 'tab_icon_active' ], | |
| 1310 | 1293 | 'data-binding-index': tabCount, |
| 1311 | 1294 | }, null, true ); |
| 1312 | 1295 | #> |
| 1313 | 1296 | |