Columns.php
1.23 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
58
<?php
namespace ACA\Pods\Service;
use AC;
use AC\Registerable;
use ACA\Pods\Column;
use ACP;
final class Columns implements Registerable {
public function register(): void
{
add_action( 'ac/column_groups', [ $this, 'register_column_groups' ] );
add_action( 'acp/column_types', [ $this, 'add_columns' ] );
}
/**
* @param AC\Groups $groups
*/
public function register_column_groups( $groups ) {
$groups->add( 'pods', 'Pods', 11 );
}
/**
* Add custom columns
*
* @param AC\ListScreen $list_screen
*/
public function add_columns( AC\ListScreen $list_screen ) {
switch ( true ) {
case $list_screen instanceof AC\ListScreen\Comment :
$list_screen->register_column_type( new Column\Comment );
break;
case $list_screen instanceof AC\ListScreen\Post :
$list_screen->register_column_type( new Column\Post );
break;
case $list_screen instanceof AC\ListScreen\Media :
$list_screen->register_column_type( new Column\Media );
break;
case $list_screen instanceof AC\ListScreen\User :
$list_screen->register_column_type( new Column\User );
break;
case $list_screen instanceof ACP\ListScreen\Taxonomy :
$list_screen->register_column_type( new Column\Taxonomy() );
break;
}
}
}