Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
added 397 characters in body; edited title
Source Link
NenadP
  • 1.5k
  • 19
  • 37

Wrapping hooks How to make hook in conditions or another functionscustom module to execute only on condition

Does Drupal have any complaints about wrappingHow to make contributed module hook in a condition, or including it in another custom made function, inexecute 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
   }

}
    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

Wrapping hooks in conditions or another functions

Does Drupal have any complaints about wrapping contributed module hook in a condition, or including it in another custom made function, in a custom module ?

if ($condition) {

   function mymodule_modulename_alter ($parameters) {
     //altering code here
   }

}

Thanks

How to make hook in custom module to execute only on condition

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
   }

}
    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

Source Link
NenadP
  • 1.5k
  • 19
  • 37

Wrapping hooks in conditions or another functions

Does Drupal have any complaints about wrapping contributed module hook in a condition, or including it in another custom made function, in a custom module ?

if ($condition) {

   function mymodule_modulename_alter ($parameters) {
     //altering code here
   }

}

Thanks