-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSV Export #823
CSV Export #823
Conversation
Allows for direct modification of the per page limit
@lukecarbis The only thing I'm not quite happy with is the page item count seems to be pushed down. I've played around with it a bit, but haven't gotten very far. Suggestions? |
@@ -687,6 +690,94 @@ public function render_list_table() { | |||
<?php | |||
} | |||
|
|||
public function maybe_render_csv_page() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest moving the maybe_render_csv_page
, render_csv_disable_paginate
, and render_csv_expand_columns
into their own Export
class, then instantiating it as a property of Admin
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I agree that this spot is more suitable for it.
} | ||
|
||
header( 'Content-type: text/csv' ); | ||
header( 'Content-Disposition: attachment; filename="output.csv"' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's brand it: stream.csv
Branded as stream.csv
Loving the progress on this. What I'd really like to see if Exporting modularised. I'm imagining an The The Basically, what I'm getting at is that it should be very easy to create an Make sense? |
Definitely. And we might as well add that while we’re at it. I’m thinking about having
|
Something about the copy messed up all of the tabs/indents causing Travis to fail. I'm going to have to go through and individually fix it. Will do that a little later today. |
Great thoughts. Let's do it. |
Move CSV functionality to separate class
List exporters at bottom of table
} | ||
|
||
public function render_download() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop blank line at top of method.
Adds keys into data array. Remove columns from data array.
For text-only output
For WP < 4.0
@lukecarbis Everything we've talked about is finished. I think we're ready to merge. Let me know if something is missing. |
header( 'Content-Disposition: attachment; filename="stream.json"' ); | ||
} | ||
|
||
if ( function_exists( 'wp_json_encode' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
@Chacha Could you please review my commits above, and give me your thoughts? a900133...49c1642 |
@lukecarbis Reviewed all commits. I am all for bringing this inline with how connectors are registered. Consistency is important. 👍 |
*/ | ||
public function is_valid_exporter( $exporter ) { | ||
if ( ! is_a( $exporter, 'WP_Stream\Exporter' ) ) { | ||
trigger_error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably trigger this error in register_exporters()
. You should be able to call is_valid_exporter()
on anything and simply get true or false. Otherwise it might be disjarring, akin to raising an exception with you call is_array( 'string' )
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
'user_id' => '', | ||
'context' => '', | ||
'action' => '', | ||
'ip' => '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing needs to be fixed here.
Closes #813
Adds a CSV export download link. Allows user to download any view of Stream Records. Uses the currently selected filters.
Also adds
stream_records_per_page
filter.