I have searched everywhere for an answer to this question, and have found little to no help on the subject.
The closest question to my own would be this, but the answer for it is a bit different than what I'm looking for: How to move block functions into .inc file?
Here is my code for the most part (everything removed that wasn't necessary):
<?php
function custom_giggity_block_info(){
$block['custom_giggity'] = array(
'info' => t('Custom giggity'),
'cache' => DRUPAL_NO_CACHE,
);
return $block;
}
function custom_giggity_block_view($delta = ''){
$block = array();
if($delta == 'custom_giggity'){
$block['content'] = custom_giggity_contents($delta);
}
return $block;
}
function custom_giggity_contents($delta){
//Code that generates what goes into $block['content']
return $output;
}
And I need to use something like this, and don't know how to incorporate it:
function giggity_contents() {
$items['giggity'] = array(
'title' => "Giggity",
'page callback' => "show_giggity", //or custom_giggity_contents ;)
'access arguments' => array('access content'),
'file' => 'giggity.inc',
'type' => MENU_CALLBACK
);
return $items;
}
Now I realize that the second block of code there might completely off, but I'm just using it as an example as to what I need to accomplish.
Edit: So this is what I'd like to accomplish, but I'm not sure how the $items callbacks work. I took this piece of code from a hook_menu() and replaced it with giggity_contents.
<?php
function custom_giggity_block_info(){
$block['custom_giggity'] = array(
'info' => t('Custom giggity'),
'cache' => DRUPAL_NO_CACHE,
);
return $block;
}
function custom_giggity_block_view($delta = ''){
$block = array();
if($delta == 'custom_giggity'){
$block['content'] = giggity_contents($delta);
}
return $block;
}
function giggity_contents() {
$items['giggity'] = array(
'title' => "Giggity",
'page callback' => "custom_giggity_contents",
'access arguments' => array('access content'),
'file' => 'giggity.inc',
'type' => MENU_CALLBACK
);
return $items;
}
giggity.inc file:
function custom_giggity_contents($delta){
//Code that generates what goes into $block['content']
return $output;
}
page callback
can be whatever function callback you want. you just need to be sure to useinclude once
orrequire once
to include your.inc
file with custom functions at the top of your module file.