Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Clear cash (admin/config/development/performance)
Edit the HTML tag for "nolink" from to: at: admin/config/system/special_menu_items
Add the link to the menu of your choice using at: admin/structure/menu
$sub_menu = '';
$main_title = check_plain(strtolower($element['#title']));
if ($element['#below']) {
// Prevent dropdown functions from being added to management menu as to not affect navbar module.
if (($element['#original_link']['menu_name'] == 'management') && (module_exists('navbar'))) {
$sub_menu = drupal_render($element['#below']);
}
else {
// Add our own wrapper
unset($element['#below']['#theme_wrappers']);
$sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
$element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
$element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
$element['#localized_options']['attributes']['aria-expanded'] = 'false';
$element['#localized_options']['attributes']['aria-haspopup'] = 'true';
// Check if this element is nested within another
if ((!empty($element['#original_link']['depth'])) && ($element['#original_link']['depth'] > 1)) {
// Generate as dropdown submenu
$element['#attributes']['class'][] = 'dropdown-submenu';
}
else {
// Generate as standard dropdown
$element['#attributes']['class'] = array('dropdown');
$element['#localized_options']['html'] = TRUE;
$element['#title'] .= ' <span class="caret"></span>';
}
// Set dropdown trigger element to # to prevent inadvertant page loading with submenu click
$element['#localized_options']['attributes']['data-target'] = '#';
}
}
// Issue #1896674 - On primary navigation menu, class 'active' is not set on active menu item.
// @see http://drupal.org/node/1896674
if (($element['#href'] == $_GET['q'] || ($element['#href'] == '<front>' && drupal_is_front_page())) && (empty($element['#localized_options']['language']) || $element['#localized_options']['language']->language == $language_url->language)) {
$element['#attributes']['class'][] = 'active';
}
if (<strong>strpos(url($element['#href']), 'nolink'</strong>)) {
echo '<pre>';print_r($element);
$output = '<a href="#'.$main_title.'" datasrc="'.$main_title.'" class="dropdown-toggle hidden-xs" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' . $element['#title'] . '</a>
<a href="#" datasrc="'.$main_title.'" class="dropdown-toggle hidden-lg hidden-md hidden-sm" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' . $element['#title'] . '</a>';
} else {
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
}
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
Comments
Comment #1
HunterT CreditAttribution: HunterT commentedAfter
Comment #2
Smokenham CreditAttribution: Smokenham commentedI am having the same problem with Drupal 7. Installed the module. Added to the url of my parent menu item.
The parent menu item is still a link and when clicked takes me to a page that says Access Forbidden
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
Error 403
localhost
12/04/11 21:18:10
Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.
Comment #3
halloffame CreditAttribution: halloffame commented+1 Having the same problem.
Comment #4
mastervissie CreditAttribution: mastervissie commented+1
Comment #5
camperqueenie CreditAttribution: camperqueenie commentedI'm getting:
Page not found
The requested page "/%3Cnolink%3E" could not be found.
I'm running Drupal 7.10 (Acquia Marina theme). Pathauto is enabled.
Comment #6
Patribus CreditAttribution: Patribus commentedsame here
I get the error message: The path '' is either invalid or you do not have access to it.
trying to create a menu item in the main menu.
I hope someone can explain the problem!
Comment #7
verumaudio CreditAttribution: verumaudio commentedYup: The requested page "/%3Cnolink%3E" could not be found.
Comment #8
sagacity CreditAttribution: sagacity commentedI had the same problem and found out that the description of the module is wrong.
You have to choose "
<separator>
" instead of "separator
" and "<nolink>
" instead of "nolink
" in the path field.For me this fixed the problem (Drupal 7.12). Hope it helps!
Comment #9
Patribus CreditAttribution: Patribus commentedI'm having also the same problem, even changing the input "
separator
" to "<separator>
" does not change the error!Comment #10
wheatpenny CreditAttribution: wheatpenny commentedI'm getting the same error message as #5. It looks like the menu item is trying to link to a page at the path of "
<nolink>
" or "<separator>
" instead of replacing those menu items with the desired output. This is on 7.12 using Pathauto and Menu Block.Comment #11
liezie_D CreditAttribution: liezie_D commentedI get the error "The requested page "/<nolink>" could not be found."
when i put <nolink> as path of my parent-menu.
Comment #12
McToth CreditAttribution: McToth commentedI have the same problem... with Genesis theme
Comment #13
sbranstetter CreditAttribution: sbranstetter commented+1 Same problem.
Comment #14
mattys CreditAttribution: mattys commentedI get the same problem, but only when the is used in a drop down menu (nice menus)
it is working fine for a non drop down menu though...
looks like could be an issue using with nice menus
doesn't look like this issue is getting a lot of love!
Comment #15
mattys CreditAttribution: mattys commentedI just uploaded latest dev version 7.x-1.x-dev (site is in development) and it seems to have sorted the problem.
Comment #16
f4o CreditAttribution: f4o commented#15 works for me to.
Comment #17
wooody CreditAttribution: wooody commentedI change HTML tag for "nolink"
In module config and it's not work, still span with dev version.
Any help...
Comment #18
wooody CreditAttribution: wooody commentedI changed it Maunally from the module code in special_menu_items.module
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commentedThis is not a bug. This is a lack of explicit documentation on the project page and in the readme. However, the menu item edit form does have an explicit instruction.
Using
<nolink>
instead of nolink works. Documenting this on the project page and in the readme will go a long way toward preventing this from being an issue in the first place.Comment #20
Anonymous (not verified) CreditAttribution: Anonymous commentedSetting this issue to "closed (works as designed" though I suggest the documentation be updated to more explicitly instruct the user how to correctly implement.
Comment #21
Delphine Lepers CreditAttribution: Delphine Lepers commentedRe-opening
Using does not work. The item leads to http://www.example.com/ < nolink > instead of not showing URL.
I am using nice menu too
Comment #22
mattsmith3 CreditAttribution: mattsmith3 commented@ #21: same issue here. updating to dev fixes the issue in the menu system, but not on the outside of the site (theme layer). Works on Bartik.. I've just checked and this is a sub theme of omega.
Comment #23
halloffame CreditAttribution: halloffame commented+1 on 6.x-1.6
Comment #24
Feckless CreditAttribution: Feckless commentedThis issue still happens in my sandbox development site on my laptop. I'm trying to build a DRUPAL 7.21 site with a WAMP Apache/2.2.22 (Win32) server, PHP/5.4.3 and MYSQL version: 5.5.24 database. OS is XP Pro.
Using MegaMenu module. When I create a
<nolink>
menu item, the text/button displays properly. When I hover on the button, the Megamenu buttons appear correctly. However, if i click on the text button, meaning the<nolink>
"parent," I get the following:Forbidden
You don't have permission to access /MySite/ on this server.
I found this post on a GOOGLE search, but it looks like it's either forgotten, fixed? - or maybe I'm doing something wrong?
Please advise.
Thanks.
Comment #25
spanac CreditAttribution: spanac commentedSeveral things to do:
<span>
to:<a href="#">
at: admin/config/system/special_menu_items<nolink>
at: admin/structure/menuAlso, follow this thread http://drupal.org/node/1867644 for mode ideas on what to change to HTML tag for "nolink" (at step 2).
Comment #26
Feckless CreditAttribution: Feckless commentedThanks for the reply. I have not had a chance to test it out yet because I gave up on the MegaMenu setup and went with Nice Menus. Want to use Megas though, so I will work on this as soon as I get a time slot.
Thanks again.
Comment #26.0
Feckless CreditAttribution: Feckless commentedProblem in first post.
Comment #27
dbolser CreditAttribution: dbolser commentedSame problem in 7.x-2.0. I don't have admin/config/system/special_menu_items. I'm using "
<nolink>
". I get the error "The path '<nolink>
' is either invalid or you do not have access to it.". This is superfish.Comment #28
rooby CreditAttribution: rooby commentedFor those of you who are using some other non standard module to print menus, like nice menus, superfish, menu block etc. can you try without those modules enabled and if that makes it work, open an issue along the lines of "Special menu items don't work with superfish module" or whatever is relevant to your use case.
I suspect that a bunch of you have different causes for your problem and it is easier to solve them if each problem has its own issue.
Comment #29
hkovacs CreditAttribution: hkovacs commentedHi All,
This does not work with the superfish module. Please disable the superfish module and will save correctly.
Comment #30
dbolser CreditAttribution: dbolser commentedWorks fine with superfish, you just need to clear caches and check permissions.
Comment #31
hardik jayeshbhai hihoriya CreditAttribution: hardik jayeshbhai hihoriya as a volunteer and commentedClear cash (admin/config/development/performance)
Edit the HTML tag for "nolink" from to: at: admin/config/system/special_menu_items
Add the link to the menu of your choice using at: admin/structure/menu