WordPress.org

Make WordPress Core

Changeset 32686


Ignore:
Timestamp:
06/03/2015 03:07:22 PM (4 years ago)
Author:
helen
Message:

List tables: tighten up primary column handling for plugins and multisite themes.

These shouldn't be able to have their primary column reassigned by default. Also removes the has-row-actions class as these list tables always have row actions visible and the JS for visual toggling conflicts. The column-primary class remains.

props stephdau.
see #25408.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

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

    r32665 r32686  
    246246
    247247    /**
    248      * Get the name of the default primary column.
     248     * Get the name of the primary column.
    249249     *
    250250     * @since 4.3.0
    251251     * @access protected
    252252     *
    253      * @return string Name of the default primary column name, in this case, 'name'.
    254      */
    255     protected function get_default_primary_column_name() {
     253     * @return string Unalterable name of the primary column name, in this case, 'name'.
     254     */
     255    protected function get_primary_column_name() {
    256256        return 'name';
    257257    }
     
    439439                $style = ' style="display:none;"';
    440440
     441            $extra_class = '';
     442            if ( $primary === $column_name ) {
     443                $extra_class = ' column-primary';
     444            }
     445
    441446            switch ( $column_name ) {
    442447                case 'cb':
     
    444449                    break;
    445450                case 'name':
    446                     echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>";
     451                    echo "<td class='theme-title{$extra_class}'$style><strong>" . $theme->display('Name') . "</strong>";
    447452                    if ( $primary === $column_name ) {
    448453                        echo $this->row_actions($actions, true);
     
    451456                    break;
    452457                case 'description':
    453                     echo "<td class='column-description desc'$style>";
     458                    echo "<td class='column-description desc{$extra_class}'$style>";
    454459                    if ( $theme->errors() ) {
    455460                        $pre = $status == 'broken' ? __( 'Broken Theme:' ) . ' ' : '';
     
    493498
    494499                default:
    495                     echo "<td class='$column_name column-$column_name'$style>";
     500                    echo "<td class='$column_name column-$column_name{$extra_class}'$style>";
    496501
    497502                    /**
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r32667 r32686  
    582582        list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
    583583
    584         $extra_class = ' has-row-actions column-primary';
     584        $extra_class = ' column-primary';
    585585
    586586        foreach ( $columns as $column_name => $column_display_name ) {
     
    720720
    721721    /**
    722      * Get the name of default primary column for this specific list table.
     722     * Get the name of primary column for this specific list table.
    723723     *
    724724     * @since 4.3.0
    725725     * @access protected
    726726     *
    727      * @return string Name for the default primary column, in this case, 'plugin'.
    728      */
    729     protected function get_default_primary_column_name() {
     727     * @return string Unalterable name for the primary column, in this case, 'plugin'.
     728     */
     729    protected function get_primary_column_name() {
    730730        return 'plugin';
    731731    }
Note: See TracChangeset for help on using the changeset viewer.