How to make contributed module hook execute only if conditions are met. Those functions seem to get automatically invoked. Environment is a custom module.
examples: 1.
if ($condition) {
function mymodule_modulename_alter ($parameters) {
//altering code here
}
}
2.
if ($condition) {
//if condition is met, i call the function included in this custom module
mymodule_modulename_alter ($parameters)
}
function mymodule_modulename_alter ($parameters) {
//but this function will get auto-invoked! I want it run only if $condition is met.
}
Thanks