redux-framework icon indicating copy to clipboard operation
redux-framework copied to clipboard

Usage of the "change" hook

Open SimoneM90 opened this issue 9 years ago • 1 comments

Hi, I want to have information about the redux/options/{opt_name}/settings/change hook because in the documentation I don't find a description about the usage of this action hook. Because the hook fires when a user has changed on option I suppose that there are two args: the id and the value of the field. But how can be retrieved the value of this two args? The structure of the function will be something like this:

function getValueChange($field_id, $field_value){
   //code here
}
add_action( "redux/options/{opt_name}/settings/change", "getValueChange"); 

Can someone explain the usage of the hook also with an example? Thanks.

SimoneM90 avatar Feb 07 '17 08:02 SimoneM90

Should be:

function getValueChange($options, $changed_values){
   //code here
}

Both $options, $changed_values are arrays. For former contains the current option set, and latter contains the changes values. You'll need to have a more than basic knowledge PHP arrays and how to traverse them to do anything with the results.

I do apologize, I don't have time to write a full fledged example.

kprovance avatar Feb 07 '17 09:02 kprovance