1

I have a drupal module creating a new page using a menu hook. And I have menu blocks (menus displayed as blocks) that SHOULD be showing up on the drupal module page. But I cannot seem to get them to display? How can I get these menu blocks to show up? I tried added it to a menu and that did not work.

Create Menu

  $items['gift_cards'] = array(
    'title' => 'SELECT A CARD',
    'page callback' => 'uc_gift_certificate_order_page',
    'access callback' => 'user_access',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

This is the function to make the page, it is simply a drupal form.

function uc_gift_certificate_order_form($form_state) {
    // This is the function that generates the required page for ordering the gift card.
    // Load the required datepicker JS/CSS
    drupal_add_css(drupal_get_path("module", "uc_gift_certificate").'/datepicker/css/datepicker.css');
    drupal_add_js(drupal_get_path("module", "uc_gift_certificate").'/datepicker/js/datepicker.js');

    // We already have the block part (gift card rotator)
    // Display the form
    $form['#attributes'] = array('class' => 'gift-card');
    DRUPAL FORM API STUFF
}
  • can you provide sample code from your module? – Mika A. Oct 18 '11 at 13:35
  • Sure I edited it. – Steven Oct 18 '11 at 13:52
2

Page callback should be drupal_get_form in your hook_menu and form definition handler should be passed as argument.

$items['gift_cards'] = array(
   'title' => 'SELECT A CARD',
   'page callback' => 'drupal_get_form',
   'page arguments' => array('uc_gift_certificate_order_page'),
   'access callback' => 'user_access', // no need to define in case of user_access
   'access arguments' => array('access content'),
   'type' => MENU_CALLBACK,
);
| improve this answer | |

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.