DiviArea.Utils.sanitizeHookName(name)
Sanitizes the given name before it is injected into a hook-name.
This function will convert the name to lower-case, replace dashes with underscores and remove any other special character.
Params
name
- The value to sanitize.
Returns
A string that is safe to use in the name of an action or filter. It contains only lower-case characters, digits and underscores.
Examples
// Sanitize a Popup ID to for a hook name.
var key = DiviArea.Utils.sanitizeHookName( area.attr( 'id' ) );
// Use the sanitized key in an action hook.
DiviArea.doAction( 'init_area_' + key, area );
Notes
No notes