General.php
832 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
40
41
42
43
44
45
46
<?php
namespace AC\Admin\Section;
use AC\Admin\Section;
use AC\Renderable;
use AC\View;
class General extends Section {
const NAME = 'general';
/**
* @var Renderable[]
*/
private $options;
public function __construct( array $options ) {
parent::__construct( self::NAME );
array_map( [ $this, 'add_option' ], $options );
}
public function add_option( Renderable $option ) {
$this->options[] = $option;
}
public function render() {
$form = new View( [
'options' => $this->options,
] );
$form->set_template( 'admin/page/settings-section-general' );
$view = new View( [
'title' => __( 'General Settings', 'codepress-admin-columns' ),
'content' => $form->render(),
'class' => '-general',
] );
$view->set_template( 'admin/page/settings-section' );
return $view->render();
}
}