refactor: finish refactoring

This commit is contained in:
Ben Goldsworthy 2021-08-09 11:27:13 +01:00
parent facda599bb
commit fbb00fab2f
30 changed files with 599 additions and 108 deletions

View file

@ -10,10 +10,7 @@ declare(strict_types=1);
namespace footnotes\includes\settings\general;
require_once plugin_dir_path( __DIR__ ) . 'class-settings-section.php';
use footnotes\includes\Settings;
use footnotes\includes\settings\SettingsSection;
use footnotes\includes\settings\general\ReferenceContainerSettingsGroup;
@ -41,6 +38,15 @@ class GeneralSettingsSection extends SettingsSection {
*/
protected array $settings_groups;
/**
* Constructs the settings section.
*
* @param string options_group_slug The slug of the settings section's options group.
* @param string section_slug The slug of the settings section.
* @param string title The name of the settings section.
*
* @since 2.8.0
*/
public function __construct(
$options_group_slug,
$section_slug,
@ -65,6 +71,23 @@ class GeneralSettingsSection extends SettingsSection {
$this->load_options_group();
}
/**
* Load the required dependencies.
*
* Include the following files that provide the settings for this section:
*
* - {@see SettingsSection}: defines a settings section;
* - {@see AMPCompatSettingsGroup};
* - {@see ReferenceContainerSettingsGroup};
* - {@see ScrollingSettingsGroup};
* - {@see ShortcodeSettingsGroup};
* - {@see NumberingSettingsGroup};
* - {@see HardLinksSettingsGroup};
* - {@see ExcerptsSettingsGroup}; and
* - {@see LoveSettingsGroup}.
*
* @see SettingsSection::load_dependencies()
*/
protected function load_dependencies(): void {
parent::load_dependencies();
@ -77,7 +100,10 @@ class GeneralSettingsSection extends SettingsSection {
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';
}
/**
* @see SettingsSection::add_settings_groups()
*/
protected function add_settings_groups(): void {
$this->settings_groups = array(
AMPCompatSettingsGroup::GROUP_ID => new AMPCompatSettingsGroup( $this->options_group_slug, $this->section_slug, $this->settings ),