| 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 |
* @since 2.0.0 |
| 12 |
*/ |
| 13 |
class SettingSection { |
| 14 |
|
| 15 |
public $id; |
| 16 |
public $title; |
| 17 |
public $callback; |
| 18 |
|
| 19 |
/** |
| 20 |
* Each section will have a single option name and the value will be array. |
| 21 |
* All individual fields will be stored as an element in the value array. |
| 22 |
* |
| 23 |
* @var string |
| 24 |
*/ |
| 25 |
public $option_name; |
| 26 |
|
| 27 |
/** |
| 28 |
* Sanitize callback for the setting. |
| 29 |
* An array will be passed to this callback. |
| 30 |
* |
| 31 |
* @var callable |
| 32 |
*/ |
| 33 |
public $sanitize_callback; |
| 34 |
|
| 35 |
/** |
| 36 |
* List of fields for this section. |
| 37 |
* |
| 38 |
* @var SettingField[] |
| 39 |
*/ |
| 40 |
public $fields = array(); |
| 41 |
|
| 42 |
/** |
| 43 |
* Default value of the fields. |
| 44 |
* |
| 45 |
* @var array |
| 46 |
* |
| 47 |
* @since 2.1.0 |
| 48 |
*/ |
| 49 |
public $default_value = array(); |
| 50 |
|
| 51 |
/** |
| 52 |
* Field labels. |
| 53 |
* |
| 54 |
* @var array |
| 55 |
* |
| 56 |
* @since 2.1.0 |
| 57 |
*/ |
| 58 |
public $field_labels = array(); |
| 59 |
|
| 60 |
/** |
| 61 |
* Add a field to the section. |
| 62 |
* |
| 63 |
* @param \EmailLog\Core\UI\Setting\SettingField $field Field to add. |
| 64 |
*/ |
| 65 |
public function add_field( SettingField $field ) { |
| 66 |
$this->fields[] = $field; |
| 67 |
} |
| 68 |
} |
| 69 |
|