0

I've created a custom menu from the drupal admin panel, and have a custom module that uses drupal's form API. I'd like to render the custom menu in this module. Since this is using form API, I don't think it makes sense to use a template file, but I can't find any way to render a menu from the .module file itself. Not only would I like to render it, but I'd like to have control over which page region it's rendered in...How can this be done?

0

I am not sure if I got you right,but if you want to call a form on a menu item.Here is view for that Implement

hook_menu() - to build custom page page callback - return your custom form here

Some sample code

function mymodulename_menu() {
  $items = array();
  $items['custom-menu'] = array(
    'title' => 'Your Custom Form',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('mymodulename_custom_form'),
    'access callback' => TRUE,
    'access arguments' => array('access content'),
  );
  return $items;
}

function mymodulename_custom_form() {
  $form = array();
  // your custom form code goes here
  return $form;
}

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.