Make WordPress Core


Ignore:
Timestamp:
07/14/2015 05:46:13 PM (9 years ago)
Author:
wonderboymusic
Message:

List Tables:

  • In ->handle_row_actions(), bail immediately if $primary and $column_name do not match. Saves us a nesting level and avoids declaring code that is unusable.
  • In WP_List_Table::single_row_columns(), allow _column_{$name} to be called dynamically by core to avoid having to override the entirety of ->single_row_columns() in WP_MS_Users_List_Table and WP_Posts_List_Table
  • In WP_MS_Sites_List_Table, id is not a column.

Props wonderboymusic, paulwilde.
Fixes #29881.

File:
1 edited

Legend:

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

    r33204 r33270  
    311311     */
    312312    protected function handle_row_actions( $link, $column_name, $primary ) {
    313         if ( $primary === $column_name ) {
    314             $edit_link = get_edit_bookmark_link( $link );
    315 
    316             $actions = array();
    317             $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
    318             $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm( '" . esc_js(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name)) . "' ) ) { return true;}return false;\">" . __('Delete') . "</a>";
    319             return $this->row_actions($actions);
     313        if ( $primary !== $column_name ) {
     314            return '';
    320315        }
     316
     317        $edit_link = get_edit_bookmark_link( $link );
     318
     319        $actions = array();
     320        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     321        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id) . "' onclick=\"if ( confirm( '" . esc_js(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name)) . "' ) ) { return true;}return false;\">" . __('Delete') . "</a>";
     322        return $this->row_actions( $actions );
    321323    }
    322324}
Note: See TracChangeset for help on using the changeset viewer.