Make WordPress Core


Ignore:
Timestamp:
11/18/2008 01:04:41 AM (17 years ago)
Author:
ryan
Message:

Dashboard pluggability improvements from mdawaffe. see #8265

File:
1 edited

Legend:

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

    r9729 r9748  
    9292    $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
    9393
     94    foreach ( $dashboard_widgets as $widget_id ) {
     95        $name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __('View all') . '</a>';
     96        wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] );
     97    }
     98
    9499    if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
    95100        ob_start(); // hack - but the same hack wp-admin/widgets.php uses
     
    102107    if ( $update )
    103108        update_option( 'dashboard_widget_options', $widget_options );
    104 
    105     foreach ( $dashboard_widgets as $widget_id )
    106         wp_add_dashboard_widget( $widget_id, $wp_registered_widgets[$widget_id]['name'], $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] );
    107109
    108110    do_action('do_meta_boxes', 'dashboard', 'normal', '');
     
    131133
    132134function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
    133     echo '<form action="" method="post">';
     135    echo '<form action="" method="post" class="dashboard-widget-control-form">';
    134136    wp_dashboard_trigger_widget_control( $meta_box['id'] );
    135137    echo "<p class='submit'><input type='hidden' name='widget_id' value='$meta_box[id]' /><input type='submit' value='" . __( 'Submit' ) . "' /></p>";
     
    802804}
    803805
     806/**
     807 * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS).
     808 */
     809function wp_dashboard_empty() {}
     810
    804811?>
Note: See TracChangeset for help on using the changeset viewer.