WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/03/2009 05:27:13 AM (10 years ago)
Author:
azaozz
Message:

Widgets UI styling, see #9511

File:
1 edited

Legend:

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

    r11155 r11160  
    2020    global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
    2121
    22     $no_widgets_shown = true;
    23     $already_shown = array(); ?>
    24 
    25     <ul id="widget-list">
    26 <?php
    27     foreach ( $wp_registered_widgets as $name => $widget ) {
    28         if ( in_array( $widget['callback'], $already_shown ) ) // We already showed this multi-widget
     22    $done = array();
     23    $sort = array_keys($wp_registered_widgets);
     24    natcasesort($sort); ?>
     25
     26    <div class="widget-holder">
     27    <div id="widget-list">
     28<?php
     29    foreach ( $sort as $val ) {
     30        $widget = $wp_registered_widgets[$val];
     31        if ( in_array( $widget['callback'], $done, true ) ) // We already showed this multi-widget
    2932            continue;
    3033
    3134        $sidebar = is_active_widget( $widget['callback'], $widget['id'] );
     35        $done[] = $widget['callback'];
    3236
    3337        if ( ! isset( $widget['params'][0] ) )
    3438            $widget['params'][0] = array();
    35 
    36         $already_shown[] = $widget['callback'];
    37         $no_widgets_shown = false;
    3839
    3940        $args = array( 'widget_id' => $widget['id'], 'widget_name' => $widget['name'], '_display' => 'template' );
     
    5253        $args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
    5354        call_user_func_array( 'wp_widget_control', $args );
    54     }
    55 
    56     if ( $no_widgets_shown )
    57       echo '<li>' . __( 'No matching widgets' ) . "</li>\n"; ?>
    58     </ul>
     55    } ?>
     56    </div>
     57    <br class='clear' />
     58    </div>
    5959<?php
    6060}
     
    6767 * @param string $sidebar
    6868 */
    69 function wp_list_widget_controls( $sidebar, $hide = false ) {
     69function wp_list_widget_controls( $sidebar ) {
    7070    add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
    71 ?>
    72 
    73     <ul class="widgets-sortables<?php echo $hide ? ' hide-if-js' : ''; ?>">
    74     <?php dynamic_sidebar( $sidebar ); ?>
    75     </ul>
    76 
    77 <?php
     71
     72    echo "\t<div id='$sidebar' class='widgets-sortables'>\n";
     73    dynamic_sidebar( $sidebar );
     74    echo "\t</div>\n";
    7875}
    7976
     
    9592    $hidden = isset($params[0]['_hide']) ? ' style="display:none;"' : '';
    9693
    97     $params[0]['before_widget'] = "<li id='widget-${i}_$id' class='widget'$hidden>";
    98     $params[0]['after_widget'] = "</li>";
     94    $params[0]['before_widget'] = "<div id='widget-${i}_$id' class='widget'$hidden>";
     95    $params[0]['after_widget'] = "</div>";
    9996    $params[0]['before_title'] = "%BEG_OF_TITLE%"; // deprecated
    10097    $params[0]['after_title'] = "%END_OF_TITLE%"; // deprecated
     
    172169    <div class="widget-top">
    173170    <div class="widget-title-action">
    174         <a class="widget-action widget-control-edit" href="<?php echo clean_url( add_query_arg( $query_arg ) ); ?>"></a>
     171        <a class="widget-action hide-if-no-js" href="#available-widgets"></a>
     172        <a class="widget-control-edit hide-if-js" href="<?php echo clean_url( add_query_arg( $query_arg ) ); ?>"><span class="edit"><?php _e('Edit'); ?></span><span class="add"><?php _e('Add'); ?></span></a>
    175173    </div>
    176174    <div class="widget-title"><h4><?php echo $widget_title ?></h4></div>
     
    179177    <div class="widget-inside">
    180178    <form action="" method="post">
    181     <div class="widget-control">
    182179<?php
    183180    if ( isset($control['callback']) )
     
    201198        <br class="clear" />
    202199    </div>
    203     </div>
    204200    </form>
     201    </div>
    205202
    206203    <div class="widget-description">
    207204<?php echo ( $widget_description = wp_widget_description($widget_id) ) ? "$widget_description\n" : "$widget_title\n"; ?>
    208205    </div>
    209     </div>
    210206<?php
    211207    echo $sidebar_args['after_widget'];
Note: See TracChangeset for help on using the changeset viewer.