Skip to content

Commit

Permalink
#4031 - Including failing "Reset Section"
Browse files Browse the repository at this point in the history
  • Loading branch information
kprovance committed Nov 13, 2024
1 parent ab85459 commit dfff9be
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 92 deletions.
15 changes: 0 additions & 15 deletions redux-core/class-redux-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,6 @@ class Redux_Core {
*/
public static ?array $typography = array();

/**
* Array of field sections.
*
* @var null|array
*/
public static ?array $field_sections = array();

/**
* Validation ran flag.
*
Expand Down Expand Up @@ -198,14 +191,6 @@ class Redux_Core {
*/
public static ?object $filesystem;


/**
* Array of field heads.
*
* @var null|array
*/
public static ?array $field_head = array();

/**
* Pointer to the third party fixes class.
*
Expand Down
122 changes: 68 additions & 54 deletions redux-core/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,226 +124,240 @@ public static function init() {
/**
* Array of field arrays.
*
* @var array
* @var null|array
*/
public ?array $fields = array();

/**
* Array of field sections.
*
* @var null|array
*/
public $fields = array();
public ?array $field_sections = array();

/**
* Array of field types.
*
* @var array
* @var null|array
*/
public $field_types = array();
public ?array $field_types = array();

/**
* Array of field heads.
*
* @var null|array
*/
public ?array $field_head = array();

/**
* Array of extensions by type used in the panel.
*
* @var array
* @var null|array
*/
public $extensions = array();
public ?array $extensions = array();

/**
* Array of sections and fields arrays.
*
* @var array|mixed|void
* @var null|array
*/
public $sections = array();
public ?array $sections = array();

/**
* Array of generated errors from the panel for localization.
*
* @var array
* @var null|array
*/
public $errors = array();
public ?array $errors = array();

/**
* Array of generated warnings from the panel for localization.
*
* @var array
* @var null|array
*/
public $warnings = array();
public ?array $warnings = array();

/**
* Array of generated sanitize notices from the panel for localization.
*
* @var array
* @var null|array
*/
public $sanitize = array();
public ?array $sanitize = array();

/**
* Array of current option values.
*
* @var array
* @var null|array
*/
public $options = array();
public ?array $options = array();

/**
* Array of option defaults.
*
* @var null
* @var null|array
*/
public $options_defaults = null;
public ?array $options_defaults = null;

/**
* Array of fields set to trigger the compiler hook.
*
* @var array
* @var null|array
*/
public $compiler_fields = array();
public ?array $compiler_fields = array();

/**
* Array of fields with CSS output selectors.
*
* @var array
* @var null|array
*/
public $output = array();
public ?array $output = array();

/**
* Autogenerated CSS appended to the header (snake case maintained for backward compatibility).
*
* @var string
*/
public $outputCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
public string $outputCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName

/**
* Autogenerated variables appended to dynamic output.
*
* @var array
* @var null|array
*/
public $output_variables = array();
public ?array $output_variables = array();

/**
* CSS sent to the compiler hook (snake case maintained for backward compatibility).
*
* @var string
*/
public $compilerCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
public string $compilerCSS = ''; // phpcs:ignore WordPress.NamingConventions.ValidVariableName

/**
* Array of global arguments.
*
* @var array|mixed
* @var array|null
*/
public $args = array();
public ?array $args = array();

/**
* Used in customizer hooks.
*
* @var string
* @var null|string
*/
public $old_opt_name = '';
public ?string $old_opt_name = '';

/**
* Pointer to the Redux_Options_Default class.
*
* @var null|Redux_Options_Defaults
*/
public $options_defaults_class = null;
public ?Redux_Options_Defaults $options_defaults_class = null;

/**
* Pointer to the Redux_Options class.
*
* @var null|Redux_Options_Constructor
*/
public $options_class = null;
public ?Redux_Options_Constructor $options_class = null;

/**
* Pointer to the Redux_Required class
*
* @var null|Redux_Required
*/
public $required_class = null;
public ?Redux_Required $required_class = null;

/**
* Pointer to the Redux_Output class.
*
* @var null|Redux_Output
*/
public $output_class = null;
public ?Redux_Output $output_class = null;

/**
* Pointer to the Redux_Page_Render class.
*
* @var null|Redux_Page_Render
*/
public $render_class = null;
public ?Redux_Page_Render $render_class = null;

/**
* Pointer to the Redux_Enqueue class.
*
* @var null|Redux_Enqueue
*/
public $enqueue_class = null;
public ?Redux_Enqueue $enqueue_class = null;

/**
* Pointer to the Redux_Transients class.
*
* @var null|Redux_Transients
*/
public $transient_class = null;
public ?Redux_Transients $transient_class = null;

/**
* Pointer to the Redux_wordPress_Data class.
*
* @var null|Redux_WordPress_Data
*/
public $wordpress_data = null;
public ?Redux_WordPress_Data $wordpress_data = null;

/**
* Pointer to the Redux_Validation class.
*
* @var null|Redux_Validation
*/
public $validate_class = null;
public ?Redux_Validation $validate_class = null;

/**
* Pointer to the Redux_Sanitize class.
*
* @var null|Redux_Validation
* @var null|Redux_Sanitize
*/
public $sanitize_class = null;
public ?Redux_Sanitize $sanitize_class = null;

/**
* Pointer to the Redux_Args class.
*
* @var null|Redux_Args
*/
public $args_class = null;
public ?Redux_Args $args_class = null;

/**
* Array of active transients used by Redux.
*
* @var array
* @var null|array
*/
public $transients = array();
public ?array $transients = array();

/**
* Array of localized repeater data.
*
* @var array
* @var null|array
*/
public $repeater_data = array();
public ?array $repeater_data = array();

/**
* Array of localized data.
*
* @var array
* @var null|array
*/
public $localize_data = array();
public ?array $localize_data = array();

/**
* Array of checked transients used by Redux.
*
* @var array
* @var null|array
*/
public $transients_check = array();
public ?array $transients_check = array();

/**
* Never save to DB flag for metaboxes.
*
* @var bool
*/
public $never_save_to_db;
public bool $never_save_to_db;

/**
* Deprecated shim for v3 templates.
Expand All @@ -352,7 +366,7 @@ public static function init() {
*
* @deprecated 4.0.0
*/
public $hidden_perm_sections = array();
public array $hidden_perm_sections = array();

/**
* Deprecated shim for v3 as plugin check.
Expand All @@ -361,7 +375,7 @@ public static function init() {
*
* @deprecated 4.0.0
*/
public static $_as_plugin = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static bool $_as_plugin = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration

/**
* Deprecated shim for v3 as plugin check.
Expand All @@ -370,7 +384,7 @@ public static function init() {
*
* @deprecated 4.0.0
*/
public static $_is_plugin = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration
public static bool $_is_plugin = false; // phpcs:ignore PSR2.Classes.PropertyDeclaration

/**
* Cloning is forbidden.
Expand Down
5 changes: 2 additions & 3 deletions redux-core/inc/classes/class-redux-options-constructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,7 @@ public function register() {

$core->field_types[ $field['type'] ] = $core->field_types[ $field['type'] ] ?? array();

//$core->field_sections[ $field['type'] ][ $field['id'] ] = $k;
Redux_Core::$field_sections[ $field['type'] ][ $field['id'] ] = $k;
$core->field_sections[ $field['type'] ][ $field['id'] ] = $k;

$display = true;

Expand Down Expand Up @@ -584,7 +583,7 @@ public function register() {
do_action( "redux/options/{$core->args['opt_name']}/field/{$field['type']}/register", $field );

$core->required_class->check_dependencies( $field );
Redux_Core::$field_head[ $field['id'] ] = $th;
$core->field_head[ $field['id'] ] = $th;

if ( ! $display || isset( $this->no_panel_section[ $k ] ) ) {
$this->no_panel[] = $field['id'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ public function reset_defaults_section( array $defaults = array() ): array {
$cur_tab = sanitize_text_field( wp_unslash( $_COOKIE['redux_current_tab'] ) );

// Get the tab/section number field is used on.
//$tab_num = $this->parent->field_sections['color_scheme'][ $this->field_id ];
$tab_num = Redux_Core::$field_sections['color_scheme'][ $this->field_id ];
$tab_num = $this->parent->field_sections['color_scheme'][ $this->field_id ];

// Match...
if ( $cur_tab === $tab_num ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,9 @@ public static function get_field( ReduxFramework $redux = null ) {
self::$parent = $redux;
}

//if ( isset( $redux->field_sections['color_scheme'] ) ) {
//if ( isset( Redux_Core::$field_sections['color_scheme'] ) ) {
//return reset( $redux->field_sections['color_scheme'] );
//var_dump(Redux_Core::$field_sections['color_scheme']);
//die;
//return reset( Redux_Core::$field_sections['color_scheme'] );
//}
if ( isset( $redux->field_sections['color_scheme'] ) ) {
return reset( $redux->field_sections['color_scheme'] );
}

$arr = self::$parent;

Expand Down
Loading

0 comments on commit dfff9be

Please sign in to comment.