php_SettingsWeightManagement.php
<?php
namespace FindStr;
class SettingsWeightManagement extends Settings {
public function __construct() {
$this->settings_option_name = 'findstrWeightManagementSettings';
/**
* Filter the weight management settings save path
*
* @hook findstr_settings_weight_management_save_path
*
* @param {string} $settings_save_file
*
* @return {string} $settings_save_file
*/
$this->settings_save_file = apply_filters( 'findstr_settings_weight_management_save_path', 'findstr/weight-management-settings.json' );
$this->default_settings = $this->get_default_settings();
parent::__construct();
}
public function get_default_settings(): object {
//json decode and encode to make sure the array is an object
return (object) array(
(object) array(
'label' => 'Post type',
'name' => 'post_type',
'value' => 'post',
'weight' => 10,
),
(object) array(
'label' => 'Post type',
'name' => 'post_type',
'value' => 'page',
'weight' => 15,
),
);
}
}