Completed
Push — master ( 419d71...4ab42b )
by Sudar
11:47
created

SettingSection::add_field()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php namespace EmailLog\Core\UI\Setting;
2
3
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
4
5
/**
6
 * A Section used in Email Log Settings page.
7
 * Ideally each add-on may have a different setting section.
8
 *
9
 * @see add_settings_section()
10
 */
11
class SettingSection {
12
13
	public $id;
14
	public $title;
15
	public $callback;
16
17
	/**
18
	 * Each section will have a single option name and the value will be array.
19
	 * All individual fields will be stored as an element in the value array.
20
	 *
21
	 * @var string
22
	 */
23
	public $option_name;
24
25
	/**
26
	 * Sanitize callback for the setting.
27
	 * An array will be passed to this callback.
28
	 *
29
	 * @var callable
30
	 */
31
	public $sanitize_callback;
32
33
	/**
34
	 * List of fields for this section.
35
	 *
36
	 * @var SettingField[]
37
	 */
38
	public $fields = array();
39
40
	/**
41
	 * Add a field to the section.
42
	 *
43
	 * @param \EmailLog\Core\UI\Setting\SettingField $field Field to add.
44
	 */
45
	public function add_field( SettingField $field ) {
46
		$this->fields[] = $field;
47
	}
48
}
49