1

I am using hook menu to define the front page (/front) and I found out if I return '' it renders the theme with all the blocks.

If I return content, is that what gets rendered into the Main Content block? What is the purpose of returning data from this function?

function dc_mad_marchness_menu()
{
    $items['front'] = array(
        'title' => 'Home',
        'page callback' => 'dc_mad_marchness_front',
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
    );

    return $items;
}


function dc_mad_marchness_front()
{
    return '';
}
  • the answer for you first question is yes – Aboodred1 Feb 21 '13 at 18:42
1

Yes, if you return either a string or a render array from a page callback function, it will be rendered in the main content region on the front end (well, under normal circumstances anyway. There are possible exceptions).

There's an in-depth description of page callback in the hook_menu() docs which is a bit long to reproduce here. I'd recommend giving it a read through.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.