WordPress.org

Make WordPress Core

Changeset 8933


Ignore:
Timestamp:
09/18/2008 10:52:07 PM (10 years ago)
Author:
ryan
Message:

Column hiding for link categories. see #7725

File:
1 edited

Legend:

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

    r8932 r8933  
    4040        if ( $count == $start && $category->parent > 0 ) {
    4141            $my_parents = array();
    42             $my_parent = $category->parent;
    4342            while ( $my_parent) {
    4443                $my_parent = get_category($my_parent);
     
    175174    $category->count = number_format_i18n( $category->count );
    176175    $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
    177     $output = "<tr id='link-cat-$category->term_id'$class>
    178                <th scope='row' class='check-column'>";
    179     if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
    180         $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
    181     } else {
    182         $output .= "&nbsp;";
    183     }
    184     $output .= "</th>
    185                 <td>$edit</td>
    186                 <td>$category->description</td>
    187                 <td class='num'>$count</td></tr>";
     176    $output = "<tr id='link-cat-$category->term_id'$class>";
     177    $columns = get_column_headers('link-category');
     178    $hidden = (array) get_user_option( 'manage-link-category-columns-hidden' );
     179    foreach ( $columns as $column_name => $column_display_name ) {
     180        $class = "class=\"$column_name column-$column_name\"";
     181
     182        $style = '';
     183        if ( in_array($column_name, $hidden) )
     184            $style = ' style="display:none;"';
     185
     186        $attributes = "$class$style";
     187
     188        switch ($column_name) {
     189            case 'cb':
     190               $output .= "<th scope='row' class='check-column'>";
     191               if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
     192                $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
     193               } else {
     194                $output .= "&nbsp;";
     195               }
     196               $output .= "</th>";
     197               break;
     198            case 'name':
     199                $output .= "<td $attributes>$edit</td>";
     200                break;
     201            case 'description':
     202                $output .= "<td $attributes>$category->description</td>";
     203                break;
     204            case 'links':
     205                $attributes = 'class="links column-links num"' . $style;
     206                $output .= "<td $attributes>$count</td>";
     207        }
     208    }
     209    $output .= '</tr>';
    188210
    189211    return apply_filters( 'link_cat_row', $output );
Note: See TracChangeset for help on using the changeset viewer.