autocomplete menu entry should have type=MENU_CALLBACK
grateful_drupal_user - May 9, 2008 - 05:57
| Project: | Related links |
| Version: | 5.x-2.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
The autocomplete callback entry was set to type MENU_LOCAL_TASK which created a blank tab in a page's menu, which, when clicked, would generate a page full of of autocomplete data. While this is only available to users with 'add related links' permissions, it's an annoyance and possibly a performance issue if you have a site where anonymous users have that permission -- think of all the bots slamming that database query...
Here's what I changed the menu definition to on my system (note that I added a title entry, as for some reason I couldn't make the tab go away without it - not sure if it was something related to the cache mechanism.)
<?php
$items[] = array(
'title' => 'Related Links Autocomplete',
'path' => 'relatedlinks/autocomplete',
'callback' => 'relatedlinks_autocomplete',
'callback arguments' => array(arg(2)),
'access' => user_access('add related links'),
'type' => MENU_CALLBACK, // MENU_LOCAL_TASK,
'weight' => 2
);
?>
#1
Fixed - thanks.
-K
P.S. It's good to always submit changes in patch form.
#2
Thanks for the prompt update.
(Regarding the patch submission, I was in a rush, so I chickened out. I'll take the time to submit a patch next time.)
#3
Automatically closed -- issue fixed for two weeks with no activity.