我在theme-settings.php中遇到高级设置问题。我可以用这个 - >
构建自定义表单mytheme_form_system_theme_settings_alter(&$form, &$form_state) {
//custom form
}
功能。但是如何在设置提交后集成新功能?像这样:
mytheme_system_theme_settings_submit_alter($form, &$form_state) {
// if form submited -> execute function
}
答案 0 :(得分:2)
您可以在alter function本身中向表单添加自定义提交处理程序:
function mytheme_form_system_theme_settings_alter(&$form, &$form_state) {
// Build up the rest of the form.
// Add your submission handler to the form.
$form['#submit'][] = 'mytheme_form_system_theme_settings_submit';
}
function mytheme_form_system_theme_settings_submit(&$form, &$form_state) {
// Form has been submitted, execute your function.
}