1

I made a custom page that has a form on it. How can I add a menu link to the authorised user menu? There is this very useful documentation http://docs.drupalgap.org/7/Menus/Adding_Links_to_Menus but how do I get the path to the custom page with the form?

In settings.js I have added this and the new link shows up.

drupalgap.settings.menus['user_menu_authenticated'] = {
  options: menu_popup_get_default_options(),
  links: [
{
  title: 'My Account',
  path: 'user',
  options: {
    attributes: {
      'data-icon': 'user',
      'class': 'ui-btn ui-btn-icon-right'
    }
  }
},
{
  title: 'Logout',
  path: 'user/logout',
  options: {
    attributes: {
      'data-icon': 'delete'
    }
  }
}, //NEW LINK
 {
  title: 'Buy points',
 // path: 'user/logout', // what path?
 page_callback: 'drupalgap_get_form',
  page_arguments: ['my_module_payment_form'],
  options: {
    attributes: {
      'data-icon': 'delete'
    }
  }
}
  ]
};

In my_module.js I have added the form like so and it shows up:

function my_module_menu() {
  try {
  var items = {};
  items['in-app'] = {
    title: 'get points',
    page_callback: 'drupalgap_get_form',
    page_arguments: ['my_module_payment_form']
};
return items;
}
   catch (error) {
      console.log('my_module_menu - ' + error);
    }
 }
0

Figured it out finally:

path: 'in-app'

Comes from the hook_menu items array.

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.