Fixing bug with the root relative and clean menu options on first save
On a clean install when you saved the theme options for the first time, the validation had a bug where the root relative URLs and clean menu output values would both be set to false even if they were true.
This commit is contained in:
@@ -288,15 +288,33 @@ function roots_theme_options_validate($input) {
|
||||
}
|
||||
|
||||
if (isset($input['root_relative_urls'])) {
|
||||
$output['root_relative_urls'] = ($input['root_relative_urls'] === 'yes') ? true : false;
|
||||
if ($input['root_relative_urls'] === 'yes') {
|
||||
$input['root_relative_urls'] = true;
|
||||
}
|
||||
if ($input['root_relative_urls'] === 'no') {
|
||||
$input['root_relative_urls'] = false;
|
||||
}
|
||||
$output['root_relative_urls'] = $input['root_relative_urls'];
|
||||
}
|
||||
|
||||
if (isset($input['clean_menu'])) {
|
||||
$output['clean_menu'] = ($input['clean_menu'] === 'yes') ? true : false;
|
||||
if ($input['clean_menu'] === 'yes') {
|
||||
$input['clean_menu'] = true;
|
||||
}
|
||||
if ($input['clean_menu'] === 'no') {
|
||||
$input['clean_menu'] = false;
|
||||
}
|
||||
$output['clean_menu'] = $input['clean_menu'];
|
||||
}
|
||||
|
||||
if (isset($input['fout_b_gone'])) {
|
||||
$output['fout_b_gone'] = ($input['fout_b_gone'] === 'yes') ? true : false;
|
||||
if ($input['fout_b_gone'] === 'yes') {
|
||||
$input['fout_b_gone'] = true;
|
||||
}
|
||||
if ($input['fout_b_gone'] === 'no') {
|
||||
$input['fout_b_gone'] = false;
|
||||
}
|
||||
$output['fout_b_gone'] = $input['fout_b_gone'];
|
||||
}
|
||||
|
||||
return apply_filters('roots_theme_options_validate', $output, $input, $defaults);
|
||||
|
||||
Reference in New Issue
Block a user