2021-05-17 12:56:22 +01:00
< ? php
/**
* File providing the `GeneralSettingsSection` class .
*
* @ package footnotes
* @ since 2.8 . 0
*/
declare ( strict_types = 1 );
2021-05-30 07:40:40 +01:00
namespace footnotes\includes\settings\general ;
2021-05-17 12:56:22 +01:00
2021-08-05 15:58:18 +01:00
require_once plugin_dir_path ( __DIR__ ) . 'class-settings-section.php' ;
2021-05-17 12:56:22 +01:00
2021-08-05 15:58:18 +01:00
use footnotes\includes\settings\SettingsSection ;
2021-05-17 12:56:22 +01:00
use footnotes\includes\settings\general\ReferenceContainerSettingsGroup ;
2021-08-05 15:58:18 +01:00
use footnotes\includes\settings\general\ScrollingSettingsGroup ;
use footnotes\includes\settings\general\ShortcodeSettingsGroup ;
2021-08-07 16:45:47 +01:00
use footnotes\includes\settings\general\NumberingSettingsGroup ;
use footnotes\includes\settings\general\HardLinksSettingsGroup ;
use footnotes\includes\settings\general\LoveSettingsGroup ;
use footnotes\includes\settings\general\ExcerptsSettingsGroup ;
use footnotes\includes\settings\general\AMPCompatSettingsGroup ;
2021-05-17 12:56:22 +01:00
/**
* Class defining general plugin settings .
*
* @ package footnotes
* @ since 2.8 . 0
*/
2021-08-05 15:58:18 +01:00
class GeneralSettingsSection extends SettingsSection {
2021-05-17 12:56:22 +01:00
/**
* The groups of settings within this section .
*
* @ var SettingsGroup []
*
* @ since 2.8 . 0
*/
protected array $settings_groups ;
2021-08-05 15:58:18 +01:00
2021-05-17 12:56:22 +01:00
public function __construct (
$options_group_slug ,
$section_slug ,
$title
) {
$this -> options_group_slug = $options_group_slug ;
2021-08-05 15:58:18 +01:00
$this -> section_slug = $section_slug ;
$this -> title = $title ;
2021-05-17 12:56:22 +01:00
$this -> load_dependencies ();
2021-08-05 15:58:18 +01:00
$this -> add_settings_groups ( get_option ( $this -> options_group_slug ) );
2021-05-22 19:31:12 +01:00
$this -> load_options_group ();
2021-05-17 12:56:22 +01:00
}
2021-08-05 15:58:18 +01:00
2021-05-17 12:56:22 +01:00
protected function load_dependencies () : void {
2021-08-05 15:58:18 +01:00
parent :: load_dependencies ();
require_once plugin_dir_path ( __DIR__ ) . 'general/class-reference-container-settings-group.php' ;
require_once plugin_dir_path ( __DIR__ ) . 'general/class-scrolling-settings-group.php' ;
require_once plugin_dir_path ( __DIR__ ) . 'general/class-shortcode-settings-group.php' ;
2021-08-07 16:45:47 +01:00
require_once plugin_dir_path ( __DIR__ ) . 'general/class-numbering-settings-group.php' ;
require_once plugin_dir_path ( __DIR__ ) . 'general/class-hard-links-settings-group.php' ;
require_once plugin_dir_path ( __DIR__ ) . 'general/class-love-settings-group.php' ;
require_once plugin_dir_path ( __DIR__ ) . 'general/class-excerpts-settings-group.php' ;
require_once plugin_dir_path ( __DIR__ ) . 'general/class-amp-compat-settings-group.php' ;
2021-05-17 12:56:22 +01:00
}
2021-08-05 15:58:18 +01:00
2021-05-17 12:56:22 +01:00
protected function add_settings_groups () : void {
2021-08-05 15:58:18 +01:00
$this -> settings_groups = array (
2021-08-07 16:45:47 +01:00
AMPCompatSettingsGroup :: GROUP_ID => new AMPCompatSettingsGroup ( $this -> options_group_slug , $this -> section_slug ),
2021-08-05 15:58:18 +01:00
ReferenceContainerSettingsGroup :: GROUP_ID => new ReferenceContainerSettingsGroup ( $this -> options_group_slug , $this -> section_slug ),
ScrollingSettingsGroup :: GROUP_ID => new ScrollingSettingsGroup ( $this -> options_group_slug , $this -> section_slug ),
ShortcodeSettingsGroup :: GROUP_ID => new ShortcodeSettingsGroup ( $this -> options_group_slug , $this -> section_slug ),
2021-08-07 16:45:47 +01:00
NumberingSettingsGroup :: GROUP_ID => new NumberingSettingsGroup ( $this -> options_group_slug , $this -> section_slug ),
HardLinksSettingsGroup :: GROUP_ID => new HardLinksSettingsGroup ( $this -> options_group_slug , $this -> section_slug ),
ExcerptsSettingsGroup :: GROUP_ID => new ExcerptsSettingsGroup ( $this -> options_group_slug , $this -> section_slug ),
LoveSettingsGroup :: GROUP_ID => new LoveSettingsGroup ( $this -> options_group_slug , $this -> section_slug ),
2021-05-17 12:56:22 +01:00
);
}
}