Make WordPress Core


Ignore:
Timestamp:
12/16/2010 07:05:14 PM (16 years ago)
Author:
scribu
Message:

Always display the table, with a placeholder row when there are no items. Fixes #15849

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-list-table.php

    r16992 r17002  
    648648
    649649        /**
    650          * Display the table or a message if there are no items
     650         * Display the table
    651651         *
    652652         * @since 3.1.0
    … …  
    654654         */
    655655        function display() {
    656                 if ( $this->has_items() ) {
    657                         $this->display_table();
    658                 } else {
    659 ?>
    660                 <br class="clear" />
    661                 <p><?php $this->no_items(); ?></p>
    662 <?php
    663                 }
    664         }
    665 
    666         /**
    667          * Get a list of CSS classes for the <table> tag
    668          *
    669          * @since 3.1.0
    670          * @access protected
    671          *
    672          * @return array
    673          */
    674         function get_table_classes() {
    675                 return array( 'widefat', 'fixed', $this->_args['plural'] );
    676         }
    677 
    678         /**
    679          * Display the full table
    680          *
    681          * @since 3.1.0
    682          * @access public
    683          */
    684         function display_table() {
    685656                extract( $this->_args );
    686657
    … …  
    702673
    703674        <tbody id="the-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>>
    704                 <?php $this->display_rows(); ?>
     675                <?php $this->display_rows_or_placeholder(); ?>
    705676        </tbody>
    706677</table>
    707678<?php
    708 
    709679                $this->display_tablenav( 'bottom' );
     680        }
     681
     682        /**
     683         * Get a list of CSS classes for the <table> tag
     684         *
     685         * @since 3.1.0
     686         * @access protected
     687         *
     688         * @return array
     689         */
     690        function get_table_classes() {
     691                return array( 'widefat', 'fixed', $this->_args['plural'] );
    710692        }
    711693
    … …  
    746728        /**
    747729         * Generate the <tbody> part of the table
     730         *
     731         * @since 3.1.0
     732         * @access protected
     733         */
     734        function display_rows_or_placeholder() {
     735                if ( $this->has_items() ) {
     736                        $this->display_rows();
     737                } else {
     738                        echo '<tr class="no-items"><td colspan="2">';
     739                        $this->no_items();
     740                        echo '</td></tr>';
     741                }
     742        }
     743
     744        /**
     745         * Generate the table rows
    748746         *
    749747         * @since 3.1.0
    … …  
    823821
    824822                ob_start();
    825                 $this->display_rows();
     823                $this->display_rows_or_placeholder();
    826824                $rows = ob_get_clean();
    827825
Note: See TracChangeset for help on using the changeset viewer.