Make WordPress Core

Changeset 8930


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

Column hiding for tags. see #7725

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-tags.php

    r8923 r8930  
    208208        </tbody>
    209209</table>
     210<?php wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false ); ?>
    210211</form>
    211212
  • trunk/wp-admin/includes/template.php

    r8928 r8930  
    327327                $out = '';
    328328                $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
    329                 $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
    330                 $out .= '<td><strong><a class="row-title" href="$edit_link" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />';
    331                 $actions = array();
    332                 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
    333                 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n  'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
    334                 $action_count = count($actions);
    335                 $i = 0;
    336                 foreach ( $actions as $action => $link ) {
    337                         ++$i;
    338                         ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
    339                         $out .= "<span class='$action'>$link$sep</span>";
    340                 }
    341                 $out .= '</td>';
    342 
    343                 $out .= "<td class='num'>$count</td>";
     329                $columns = get_column_headers('tag');
     330                $hidden = (array) get_user_option( 'manage-tag-columns-hidden' );
     331                foreach ( $columns as $column_name => $column_display_name ) {
     332                        $class = "class=\"$column_name column-$column_name\"";
     333
     334                        $style = '';
     335                        if ( in_array($column_name, $hidden) )
     336                                $style = ' style="display:none;"';
     337
     338                        $attributes = "$class$style";
     339
     340                        switch ($column_name) {
     341                                case 'cb':
     342                                        $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
     343                                        break;
     344                                case 'name':
     345                                        $out .= '<td ' .  $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' . $name . '</a></strong><br />';
     346                                        $actions = array();
     347                                        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     348                                        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this tag '%s'\n  'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
     349                                        $action_count = count($actions);
     350                                        $i = 0;
     351                                        foreach ( $actions as $action => $link ) {
     352                                                ++$i;
     353                                                ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
     354                                                $out .= "<span class='$action'>$link$sep</span>";
     355                                        }
     356                                        $out .= '</td>';
     357                                        break;
     358                                case 'posts':
     359                                        $attributes = 'class="posts column-posts num"' . $style;
     360                                        $out .= "<td $attributes>$count</td>";
     361                                        break;
     362                        }
     363                }
     364
    344365                $out .= '</tr>';
    345366
Note: See TracChangeset for help on using the changeset viewer.