Make WordPress Core


Ignore:
Timestamp:
07/05/2016 03:21:44 PM (10 years ago)
Author:
ocean90
Message:

Dashboard: Don't add a "Configure" link to the toggle button.

The HTML for the toggle gets appended to the widget name which is later used for the widget title and the screen reader text of the toggle button. Storing the original widget name in the arguments allows us to use the name without the HTML for the screen reader text and doesn't require further changes by plugin developers.

Props nicholas_io, swissspidy.
Fixes #35021.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/screen.php

    r37534 r37972  
    118118                                if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )
    119119                                        continue;
    120                                 $box_id = $box['id'];
    121                                 echo '<label for="' . $box_id . '-hide">';
    122                                 echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />';
    123                                 echo "{$box['title']}</label>\n";
     120
     121                                $widget_title = $box['title'];
     122
     123                                if ( isset( $box['args']['__widget_basename'] ) ) {
     124                                        $widget_title = $box['args']['__widget_basename'];
     125                                }
     126
     127                                printf(
     128                                        '<label for="%1$s-hide"><input class="hide-postbox-tog" name="%1$s-hide" type="checkbox" id="%1$s-hide" value="%1$s" %2$s />%3$s</label>',
     129                                        esc_attr( $box['id'] ),
     130                                        checked( in_array( $box['id'], $hidden ), false, false ),
     131                                        $widget_title
     132                                );
    124133                        }
    125134                }
Note: See TracChangeset for help on using the changeset viewer.