NotSavedListScreen.php
1.32 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
<?php
namespace ACP\Admin\Notice;
use AC\ListScreen;
use AC\Message;
use AC\Registerable;
class NotSavedListScreen implements Registerable
{
public function register(): void
{
add_action('ac/settings/notice', [$this, 'render_notice']);
}
public function render_notice(ListScreen $list_screen): void
{
if ( ! $list_screen->has_id()) {
$message = sprintf(
'%s %s',
sprintf(
__('These settings are %s.', 'codepress-admin-columns'),
sprintf('<strong>%s</strong>', __('inactive', 'codepress-admin-columns'))
),
sprintf(
__(
'Click %s to apply these column settings to the %s list table.',
'codepress-admin-columns'
),
sprintf('<strong>%s</strong>', __('Save', 'codepress-admin-columns')),
sprintf(
'<strong>%s</strong>',
esc_html($list_screen->get_title() ?: $list_screen->get_label())
)
)
);
$message = sprintf('<p>%s</p>', $message);
$notice = new Message\InlineMessage($message, Message::INFO);
echo $notice->render();
}
}
}