Timeline for Moving functions in block module to inc file
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 22, 2014 at 19:36 | vote | accept | Luke3butler | ||
Aug 22, 2014 at 19:31 | comment | added | tenken | The functions in modules dont work that way. You're think PSR autoloading ..... this simply isn't that. | |
Aug 22, 2014 at 19:29 | comment | added | Luke3butler | @tenken I was thinking it might come to that. My goal was to make drupal only load that file when the hook is called, instead of in the module file which is always loaded for enabled modules. | |
Aug 22, 2014 at 18:50 | comment | added | tenken |
If you use include_once in your module file then you no longer need file => foo.inc .
|
|
Aug 22, 2014 at 18:36 | comment | added | Luke3butler | Doesn't work. $block['content'] is getting array( 'title' => "Giggity", 'page callback' => "custom_giggity_contents", 'access arguments' => array('access content'), 'file' => 'giggity.inc', 'type' => MENU_CALLBACK ); as it's content. | |
Aug 22, 2014 at 15:36 | comment | added | NeoHQ | It will work, you only need to include "giggity.inc" file at the top of "module_name.module" file as I did above, after that you can use those function eveywhere inside ".module" file, doesn't matter if you use them as callbacks or calling the functions directly. | |
Aug 22, 2014 at 14:41 | comment | added | Luke3butler | I realize that. I'm sorry, I didn't communicate very well. I added to my OP with what I'd like the result to look like. | |
Aug 22, 2014 at 14:28 | comment | added | NeoHQ | You want to replace 3 functions with 1 ? You can't, each hook has it's own purpose. If the question is another I don't understand it. | |
Aug 21, 2014 at 21:58 | comment | added | Luke3butler | Is the answer staring me in the face? I can literally use the code I posted on the second block? | |
Aug 21, 2014 at 21:10 | history | edited | NeoHQ | CC BY-SA 3.0 |
improve formatting
|
Aug 21, 2014 at 21:03 | history | answered | NeoHQ | CC BY-SA 3.0 |