LayoutTabs.php
954 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
<?php
namespace ACP\Admin\Section\Partial;
use AC\Renderable;
use AC\View;
use ACP\Settings\Option;
class LayoutTabs implements Renderable
{
private $option;
public function __construct()
{
$this->option = new Option\LayoutStyle();
}
public function render(): string
{
$options = [
Option\LayoutStyle::OPTION_TABS => _x('Tabs', 'table view display', 'codepress-admin-columns'),
Option\LayoutStyle::OPTION_DROPDOWN => _x('Dropdown', 'table view display', 'codepress-admin-columns'),
];
$setting = new View([
'options' => json_encode($options),
'value' => $this->option->get() ?: Option\LayoutStyle::OPTION_DROPDOWN,
]);
$setting->set_template('admin/settings/layout-style');
$view = new View(['setting' => $setting->render()]);
return $view->set_template('admin/settings/setting-row')->render();
}
}