Make WordPress Core


Ignore:
Timestamp:
11/27/2013 01:29:49 AM (10 years ago)
Author:
azaozz
Message:

Widgets: drop onto closed sidebars.

  • Make dropping a widget easier by preventing the source sidebar from resizing while the widget is being dragged.
  • Move widgets dropped on closed sidebars to the top. UI Sortable places them randomly near the bottom.
  • Fix possible regression in wp_list_widget_controls(), add an optional argument to output the sidebar name inside the sortable container.
  • Updated styles for sidebar description and widget-hover class.

Part props shaunandrews, fixes #25952.

File:
1 edited

Legend:

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

    r26140 r26426  
    6464 *
    6565 * @param string $sidebar id slug of the sidebar
    66  */
    67 function wp_list_widget_controls( $sidebar ) {
     66 * @param string optional $sidebar_name Include the HTML for the sidebar name
     67 */
     68function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) {
    6869    add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
    6970
    7071    $description = wp_sidebar_description( $sidebar );
    7172
    72     if ( !empty( $description ) ) {
    73         echo "<div class='sidebar-description'>\n";
    74         echo "\t<p class='description'>$description</p>";
    75         echo "</div>\n";
    76     }
    77 
    78     echo "<div id='$sidebar' class='widgets-sortables'>\n";
     73    echo '<div id="' . esc_attr( $sidebar ) . '" class="widgets-sortables">';
     74
     75    if ( $sidebar_name ) {
     76        ?>
     77        <div class="sidebar-name">
     78            <div class="sidebar-name-arrow"><br /></div>
     79            <h3><?php echo esc_html( $sidebar_name ); ?> <span class="spinner"></span></h3>
     80        </div>
     81        <?php
     82    }
     83
     84    echo '<div class="sidebar-description">';
     85
     86    if ( ! empty( $description ) ) {
     87        echo '<p class="description">' . $description . '</p>';
     88    }
     89
     90    echo '</div>';
     91
    7992    dynamic_sidebar( $sidebar );
    80     echo "</div>\n";
     93
     94    echo '</div>';
    8195}
    8296
Note: See TracChangeset for help on using the changeset viewer.