← All changes
|
app/modules/import-export-customization/utils.php
+0
-21
4.2.2
→
3.35.0-dev2
View file →
| @@ -150,26 +150,5 @@ | ||
| 150 | 150 | $space_between_widgets['isLinked'] = true; |
| 151 | 151 | |
| 152 | 152 | return $space_between_widgets; |
| 153 | 153 | } |
| 154 | - | |
| 155 | - public static function resolve_label_conflict( string $label, array $existing_labels, int $max_length = 50 ): string { | |
| 156 | - $lower_label = strtolower( $label ); | |
| 157 | - | |
| 158 | - if ( ! in_array( $lower_label, $existing_labels, true ) ) { | |
| 159 | - return $label; | |
| 160 | - } | |
| 161 | - | |
| 162 | - $suffix = 1; | |
| 163 | - $max_suffix_attempts = 1000; | |
| 164 | - | |
| 165 | - do { | |
| 166 | - $suffix_str = '_' . $suffix; | |
| 167 | - $max_base_length = $max_length - strlen( $suffix_str ); | |
| 168 | - $base_label = mb_substr( $label, 0, $max_base_length ); | |
| 169 | - $new_label = $base_label . $suffix_str; | |
| 170 | - ++$suffix; | |
| 171 | - } while ( in_array( strtolower( $new_label ), $existing_labels, true ) && $suffix < $max_suffix_attempts ); | |
| 172 | - | |
| 173 | - return $new_label; | |
| 174 | - } | |
| 175 | 154 | } |