Commit cb89c0dc authored by Michael Iseard's avatar Michael Iseard
Browse files

Add goal column

parent 5c48a8a6
...@@ -39,8 +39,9 @@ class CampaignsTable extends WP_List_Table { ...@@ -39,8 +39,9 @@ class CampaignsTable extends WP_List_Table {
]; ];
$this->export_columns = [ $this->export_columns = [
'name' => __( 'Email', 'kudos-donations' ), 'name' => __( 'Name', 'kudos-donations' ),
'transactions' => __( 'Street', 'kudos-donations' ), 'transactions' => __( 'Transactions', 'kudos-donations' ),
'goal' => __( 'Goal', 'kudos-donations' ),
'total' => __( 'Total', 'kudos-donations' ), 'total' => __( 'Total', 'kudos-donations' ),
]; ];
...@@ -76,7 +77,6 @@ class CampaignsTable extends WP_List_Table { ...@@ -76,7 +77,6 @@ class CampaignsTable extends WP_List_Table {
*/ */
public function fetch_table_data(): array { public function fetch_table_data(): array {
$mapper = $this->mapper;
$search = $this->get_search_data(); $search = $this->get_search_data();
$campaigns = $this->campaigns->get_all(); $campaigns = $this->campaigns->get_all();
...@@ -123,6 +123,7 @@ class CampaignsTable extends WP_List_Table { ...@@ -123,6 +123,7 @@ class CampaignsTable extends WP_List_Table {
'name' => __( 'Name', 'kudos-donations' ), 'name' => __( 'Name', 'kudos-donations' ),
'transactions' => __( 'Transactions', 'kudos-donations' ), 'transactions' => __( 'Transactions', 'kudos-donations' ),
'total' => __( 'Total', 'kudos-donations' ), 'total' => __( 'Total', 'kudos-donations' ),
'goal' => __( 'Goal', 'kudos-donations' ),
'last_donation' => __( 'Last Donation', 'kudos-donations' ), 'last_donation' => __( 'Last Donation', 'kudos-donations' ),
]; ];
} }
...@@ -259,6 +260,23 @@ class CampaignsTable extends WP_List_Table { ...@@ -259,6 +260,23 @@ class CampaignsTable extends WP_List_Table {
} }
/**
* Goal column
*
* @param array $item Array of results.
*
* @return string
* @since 2.3.2
*/
protected function column_goal( array $item ): string {
$currency = ! empty( $item['currency'] ) ? Utils::get_currency_symbol( $item['currency'] ) : '';
$total = $item['goal'];
return $currency . ' ' . ( is_numeric( $total ) ? number_format_i18n( $total, 2 ) : '' );
}
/** /**
* Shows the date of the last translation * Shows the date of the last translation
* *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment