Addons.php
1.1 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
<?php
namespace ACP\Admin\Page;
use AC;
use AC\IntegrationRepository;
use AC\Renderable;
use AC\View;
use ACP;
class Addons extends AC\Admin\Page\Addons {
protected function render_actions( AC\Integration $addon ): ?Renderable {
return $addon->is_plugin_active()
? ( new View() )->set_template( 'admin/page/component/addon/active-label' )
: null;
}
protected function get_grouped_addons() {
$groups = [];
$active = $this->integrations->find_all( [
IntegrationRepository::ARG_FILTER => [
new ACP\Integration\Filter\IsActive(),
],
] );
if ( $active->exists() ) {
$groups[] = [
'title' => __( 'Active', 'codepress-admin-columns' ),
'class' => 'active',
'integrations' => $active,
];
}
$not_active = $this->integrations->find_all( [
IntegrationRepository::ARG_FILTER => [
new AC\Integration\Filter\IsPluginNotActive(),
],
] );
if ( $not_active->exists() ) {
$groups[] = [
'title' => __( 'Available', 'codepress-admin-columns' ),
'class' => 'available',
'integrations' => $not_active,
];
}
return $groups;
}
}