Ticket #35023: get_field_name_alt.patch
File get_field_name_alt.patch, 1.2 KB (added by , 9 years ago) |
---|
-
src/wp-includes/class-wp-widget.php
183 183 * @param string $field_name Field name 184 184 * @return string Name attribute for $field_name 185 185 */ 186 public function get_field_name( $field_name) {187 if ( false === $pos = strpos( $field_name, '[') ) {186 public function get_field_name( $field_name ) { 187 if ( ! preg_match( '/]$/', $field_name ) ) { 188 188 return 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']'; 189 189 } else { 190 $pos = strpos( $field_name, '[' ); 190 191 return 'widget-' . $this->id_base . '[' . $this->number . '][' . substr_replace( $field_name, '][', $pos, strlen( '[' ) ); 191 192 } 192 193 } -
tests/phpunit/tests/widgets.php
351 351 'widget-foo[2][posttypes][4][][6]', 352 352 'posttypes[4][][6]', 353 353 ), 354 array( 355 'widget-foo[2][posttypes][name]', 356 'posttypes][name', 357 ), 354 358 ); 355 359 } 356 360