Formality hooks reference
<?php | |
/** | |
* Formality hooks reference | |
* | |
* @link https://formality.dev | |
* @since 1.1 | |
* @package Formality | |
* @author Michele Giorgi <hi@giorgi.io> | |
*/ | |
/** | |
* Filters reference | |
*/ | |
add_filter('formality_form_body_classes', function($classes) { | |
//add or remove body classes from $classes array here | |
return $classes; | |
}); | |
add_filter('formality_form_template', function($template) { | |
//change form template path here | |
return $template; | |
}); | |
add_filter('formality_form_header', function($html, $form_id) { | |
//edit rendered $html here | |
return $html; | |
}, 10, 2); | |
add_filter('formality_form_body', function($html, $form_id) { | |
//edit rendered $html here | |
return $html; | |
}, 10, 2); | |
add_filter('formality_form_sidebar', function($html, $form_id) { | |
//edit rendered $html here | |
return $html; | |
}, 10, 2); | |
add_filter('formality_form_nav', function($html, $form_id) { | |
//edit rendered $html here | |
return $html; | |
}, 10, 2); | |
add_filter('formality_form_footer', function($html, $form_id) { | |
//edit rendered $html here | |
return $html; | |
}, 10, 2); | |
add_filter('formality_form_style', function($html, $form_id) { | |
//edit rendered $html here | |
return $html; | |
}, 10, 2); | |
add_filter('formality_form_field', function($html, $field) { | |
//edit rendered $html here | |
return $html; | |
}, 10, 2); | |
add_filter('formality_form_result', function($html, $form_id) { | |
//edit rendered $html here | |
return $html; | |
}, 10, 2); | |
add_filter('formality_form_credits', function($html, $form_id) { | |
//edit rendered $html here | |
return $html; | |
}, 10, 2); | |
add_filter('formality_sanitized_data', function($data) { | |
//edit sanitezed data here | |
return $data; | |
}, 10, 2); | |
/** | |
* Actions reference | |
*/ | |
add_action('formality_after_validation', function($data){ | |
//do something here | |
}); | |
add_action('formality_before_save_data', function($data){ | |
//do something here | |
}); | |
add_action('formality_before_notification', function($data){ | |
//do something here | |
}); | |
add_action('formality_after_notification', function($data){ | |
//do something here | |
}); | |
add_action('formality_after_save_data', function($data, $errors){ | |
//do something here | |
}, 10, 2); | |
/** | |
* JS dom events reference | |
*/ | |
add_action('wp_print_scripts', function() { ?> | |
<script> | |
window.addEventListener("foFieldFocus", function(e) { console.log(e.detail); }) | |
window.addEventListener("foFieldFilled", function(e) { console.log(e.detail); }) | |
window.addEventListener("foFormSubmit", function(e) { console.log(e.detail); }) | |
window.addEventListener("foFormSuccess", function(e) { console.log(e.detail); }) | |
window.addEventListener("foFormError", function(e) { console.log(e.detail); }) | |
window.addEventListener("foSidebarOpen", function(e) { console.log(e.detail); }) | |
window.addEventListener("foSidebarClose", function(e) { console.log(e.detail); }) | |
</script> | |
<?php }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment