mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-13 21:30:26 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@26426 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -63,21 +63,35 @@ function _sort_name_callback( $a, $b ) {
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @param string $sidebar id slug of the sidebar
|
||||
* @param string optional $sidebar_name Include the HTML for the sidebar name
|
||||
*/
|
||||
function wp_list_widget_controls( $sidebar ) {
|
||||
function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) {
|
||||
add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
|
||||
|
||||
$description = wp_sidebar_description( $sidebar );
|
||||
|
||||
if ( !empty( $description ) ) {
|
||||
echo "<div class='sidebar-description'>\n";
|
||||
echo "\t<p class='description'>$description</p>";
|
||||
echo "</div>\n";
|
||||
echo '<div id="' . esc_attr( $sidebar ) . '" class="widgets-sortables">';
|
||||
|
||||
if ( $sidebar_name ) {
|
||||
?>
|
||||
<div class="sidebar-name">
|
||||
<div class="sidebar-name-arrow"><br /></div>
|
||||
<h3><?php echo esc_html( $sidebar_name ); ?> <span class="spinner"></span></h3>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
echo "<div id='$sidebar' class='widgets-sortables'>\n";
|
||||
echo '<div class="sidebar-description">';
|
||||
|
||||
if ( ! empty( $description ) ) {
|
||||
echo '<p class="description">' . $description . '</p>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
dynamic_sidebar( $sidebar );
|
||||
echo "</div>\n";
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user