Make WordPress Core


Ignore:
Timestamp:
05/29/2015 02:40:52 AM (10 years ago)
Author:
helen
Message:

List tables: introduce the concept of a "primary" column.

This becomes the column that contains the row actions, and allows for a more flexibility, particularly with custom post types and list tables. To (re)define the primary column, use the list_table_primary_column filter, which receives the column name and the screen ID as arguments.

props stephdau, DaveAl, jesin.
see #25408.

File:
1 edited

Legend:

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

    r32642 r32644  
    231231
    232232    /**
     233     * Get name of default primary column
     234     *
     235     * @since 4.3.0
     236     * @access protected
     237     *
     238     * @return string
     239     */
     240    protected function get_default_primary_column_name() {
     241        return 'name';
     242    }
     243
     244    /**
    233245     *
    234246     * @global array $totals
     
    401413        echo "<tr id='$id' class='$class'>";
    402414
    403         list( $columns, $hidden ) = $this->get_column_info();
     415        list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
    404416
    405417        foreach ( $columns as $column_name => $column_display_name ) {
     
    414426                case 'name':
    415427                    echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>";
    416                     echo $this->row_actions( $actions, true );
     428                    if ( $primary === $column_name ) {
     429                        echo $this->row_actions($actions, true);
     430                    }
    417431                    echo "</td>";
    418432                    break;
     
    452466                    echo implode( ' | ', $theme_meta );
    453467
    454                     echo "</div></td>";
     468                    echo '</div>';
     469                    if ( $primary === $column_name ) {
     470                        echo $this->row_actions($actions, true);
     471                    }
     472                    echo '</td>';
    455473                    break;
    456474
     
    468486                     */
    469487                    do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme );
     488
     489                    if ( $primary === $column_name ) {
     490                        echo $this->row_actions($actions, true);
     491                    }
    470492                    echo "</td>";
    471493            }
Note: See TracChangeset for help on using the changeset viewer.