ListScreenId.php
823 Bytes
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
<?php
namespace AC\Admin\ScreenOption;
use AC\Admin\Preference;
use AC\Admin\ScreenOption;
class ListScreenId extends ScreenOption
{
private const KEY = 'show_list_screen_id';
private $preference;
public function __construct(Preference\ScreenOptions $preference)
{
$this->preference = $preference;
}
public function is_active(): bool
{
return 1 === $this->preference->get(self::KEY);
}
public function render(): string
{
ob_start();
?>
<label for="ac-list-screen-id" data-ac-screen-option="<?= self::KEY ?>">
<input id="ac-list-screen-id" type="checkbox" <?php
checked($this->is_active()); ?>>
<?= __('List Screen ID', 'codepress-admin-columns') ?>
</label>
<?php
return ob_get_clean();
}
}