WordPress.org

Make WordPress Core

Opened 16 months ago

Closed 3 months ago

#23122 closed enhancement (fixed)

inline doc improvements in WP_Filesystem_Direct and WP_List_Table

Reported by: bananastalktome Owned by:
Milestone: 3.7 Priority: normal
Severity: trivial Version: 3.5
Component: Inline Docs Keywords: has-patch
Focuses: Cc:

Description

A pass over WP_Filesystem_Direct and WP_List_Table classes to improve inline docs. Any suggestions/improvements/critiques are welcomed.

Attachments (1)

patch.diff (10.0 KB) - added by bananastalktome 16 months ago.

Download all attachments as: .zip

Change History (6)

bananastalktome16 months ago

comment:1 SergeyBiryukov16 months ago

  • Milestone changed from Awaiting Review to 3.6
  • Version changed from trunk to 3.5

comment:2 kitchin14 months ago

I suggest this at Line 576 in wp-admin/includes/class-wp-list-table.php

 	 * Get a list of sortable columns. The format is:
 	 * 'internal-name' => 'orderby'
 	 * or
+	 * 'internal-name' => array( 'orderby', false )
+	 * or
 	 * 'internal-name' => array( 'orderby', true )
 	 *
-	 * The second format will make the initial sorting order be descending
+	 * The third format will make the initial sorting order be descending.
+	 *
+	 * If your class explicitly sets $this->_column_headers,
+	 * note the first format is invalid in print_column_headers().
 	 *
 	 * @since 3.1.0
 	 * @access protected
	 *
	 * @return array
	 */
	function get_sortable_columns() {
		return array();
	}

The problem with the first format is that print_column_headers() expects an array at line 686:

list( $orderby, $desc_first ) = $sortable[$column_key];

The first format is OK when it is rolled into an array by get_column_info(), but if you set _column_headers explicitly, then get_column_info() is bypassed. This is the approach taken by the API example plugin http://wordpress.org/extend/plugins/custom-list-table-example/ , which does use the correct second format.

comment:3 ryan11 months ago

  • Milestone changed from 3.6 to Future Release

comment:4 dd327 months ago

In 25560:

First pass at documenting the WP_Filesystem methods. This also introduces stubs of the methods into the base class which are documented, which subclasses can override, some methods were cleaned up at the same time.
See #18476 See #23122. Props kurtpayne, bananastalktome, and, DrewAPicture

comment:5 nacin3 months ago

  • Milestone changed from Future Release to 3.7
  • Resolution set to fixed
  • Status changed from new to closed

New tickets for more patches, I guess. Closing as fixed for 3.7.

Note: See TracTickets for help on using tickets.