Privacy: Introduce `manage_{$this->screen->id}_custom_column` action in `WP_Privacy_Requests_Table::column_default()`.

This brings some consistency with other list tables and allows for adding custom column data to columns registered with `manage_export-personal-data_columns` or `manage_erase-personal-data_columns` filters.

Props xkon, garrett-eclipse, birgire, pbiron, hellofromTonya, TimothyBlynJacobs, 7studio, mukesh27, Mista-Flo.
Fixes #44354.
Built from https://develop.svn.wordpress.org/trunk@50145


git-svn-id: http://core.svn.wordpress.org/trunk@49824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-02-02 16:44:04 +00:00
parent 373ee89c83
commit ce816eeda1
2 changed files with 25 additions and 8 deletions

View File

@ -484,19 +484,36 @@ abstract class WP_Privacy_Requests_Table extends WP_List_Table {
* Default column handler.
*
* @since 4.9.6
* @since 5.7.0 Added `manage_{$this->screen->id}_custom_column` action.
*
* @param WP_User_Request $item Item being shown.
* @param string $column_name Name of column being shown.
* @return string Default column output.
*/
public function column_default( $item, $column_name ) {
$cell_value = $item->$column_name;
/**
* Fires for each custom column of a specific request type in the Requests list table.
*
* Custom columns are registered using the {@see 'manage_export-personal-data_columns'}
* and the {@see 'manage_erase-personal-data_columns'} filters.
*
* @since 5.7.0
*
* @param string $column_name The name of the column to display.
* @param WP_User_Request $item The item being shown.
*/
do_action( "manage_{$this->screen->id}_custom_column", $column_name, $item );
}
if ( in_array( $column_name, array( 'created_timestamp' ), true ) ) {
return $this->get_timestamp_as_date( $cell_value );
}
return $cell_value;
/**
* Created timestamp column. Overridden by children.
*
* @since 5.7.0
*
* @param WP_User_Request $item Item being shown.
* @return string Human readable date.
*/
public function column_created_timestamp( $item ) {
return $this->get_timestamp_as_date( $item->created_timestamp );
}
/**

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.7-alpha-50144';
$wp_version = '5.7-alpha-50145';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.