-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload-table.php
More file actions
57 lines (45 loc) · 1.39 KB
/
upload-table.php
File metadata and controls
57 lines (45 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
if ( !defined( 'ABSPATH' ) )
exit;
if ( !class_exists( 'WP_List_Table' ) )
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
class WP_Gallery_To_Photonic_Upload_List_Table extends WP_List_Table {
function get_columns(): array {
return [
'thumbnail' => 'Thumbnail',
'id' => 'ID',
'title' => 'Title',
'caption' => 'Caption',
];
}
function prepare_items( array $items = [] ): void {
$columns = $this->get_columns();
$hidden = [];
$sortable = [];
$this->_column_headers = [ $columns, $hidden, $sortable, ];
$this->items = $items;
}
function column_thumbnail( int $id ): string {
$return = '';
$return .= '<div style="height: 40px; width: 40px;">' . "\n";
$return .= wp_get_attachment_image( $id, 'thumbnail', FALSE, [
'style' => 'max-height: 100%; height: auto; max-width: 100%; width: auto;',
] ) . "\n";
$return .= '</div>' . "\n";
return $return;
}
function column_id( int $id ): string {
$href = add_query_arg( [
'post' => $id,
'action' => 'edit',
], admin_url( 'post.php' ) );
return sprintf( '<a href="%s" target="_blank">%s</a>', esc_url_raw( $href ), esc_html( $id ) );
}
function column_title( int $id ): string {
return esc_html( get_the_title( $id ) );
}
function column_caption( int $id ): string {
return esc_html( wp_get_attachment_caption( $id ) );
}
function display_tablenav( $which ): void {}
}