Closed (won't fix)
Project:
Bootstrap
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Apr 2014 at 10:46 UTC
Updated:
9 Mar 2017 at 18:07 UTC
Jump to comment: Most recent
Comments
Comment #1
rroblik commentedHi,
I'm encountering issue whit submenu when I use view (with module Menu Views)
Submenu is only outputed as
<ul ... ><li><a href="<view>"></a></li></ul>The problem seem to came from
bootstrap_menu_link()(insidemenu-link.func.php)When I comment this function, my view is outputted as desired (raw, without bootstrap class of course)
My question is : how to disable this hook (bootstrap_menu_link) without modify the main theme ?
or
Is that normal view to not render (ouput) when used as (sub)menu with Bootstrap ?
Thanks for answers.
NB : Menu Views module use
hook_menu_linkalso, so as Bootstrap is a template, I thinkbootstrap_menu_linkhook is running after the module, but I'm not sure ...Comment #2
tahiticlic commentedHi,
same here!
I can't find where the conflict is, any help welcome :-)
Comment #3
tahiticlic commentedHi,
here is a solution (customized for our purpose, but the idea is to treat $view as a sub menu in a custom hook_theme_link implementation) :
Comment #4
plazik commented#2324105: Modules can't overwritne theme functions
Comment #5
plazik commentedMarked #2324105: Modules can't overwritne theme functions as duplicate.
Temporary solution https://www.drupal.org/node/2324105#comment-9114687
Comment #6
tahiticlic commented@Plazik According to the amount of differences, I can't see how it is a solution... Have you explored all the possible effects of such a file regression ?
Comment #7
rroblik commented@tahiticlic agree with you
But this tread is pretty old ... my workaround is not far away from your's.
Your fix #3 should be adapted because if the submenu is a view, the parent
<a>still have "<view>" insidehrefattribute.Here is pieces of my fix
I'm not sure what is the best solution / fix but I hope Bootstrap theme will handle a fix to be natively compatible with
menu_viewsmoduleCheers
Comment #8
plazik commented@rroblik your fix is only for
menu_viewsmodule but my fix is for all modules (example,path_breadcrumbsmodule). It's not the best and not final but it works.@tahiticlic
registry.incfile contains functions specific to the theme registry but bootstrap-7.x-3.1-beta2 doesn't work well with other modules themes.The problem is in
registry.incfile and we should find the proper fix.Comment #9
markhalliwell@Plazik, can you please elaborate on: "The problem is in registry.inc file and we should find the proper fix."? What, exactly, is the problem?
Comment #10
plazik commented@markcarver, see my comment https://www.drupal.org/node/2324105#comment-9090789.
Comment #11
markhalliwellI'm really tempted to say this is really just "works as designed" more than anything. There's actually nothing wrong with the theme registry; themes are supposed to override theme hooks provided by modules.
Obviously, what this issue really boils down to is: there's a conflict between the module (which provides advanced/different display logic) and theme (which provides its own classes/markup to work with the framework).
When a module (such as menu_views or path_breadcrumbs) implements an alter though, it has always been up to the the theme (or sub-theme) to re-implement that template (function) if needed. The "solution" for these types of conflicts are usually never very "easy" to solve and almost always have to be handled manually in some sort of fashion.
Furthermore, it's often the module that do not implement/segregate the theme hook properly and put in too much custom logic that it's nearly impossible to just "inject" the necessary bootstrap classes/markup. We end up having to copy over the entire function for this module's logic and end up having to maintain this block of the modules code (which isn't ideal for anyone involved).
After thinking about this though, there may be one possible way to semi-help with this "issue", so I'll mark as a feature request and postpone for a rainy day:
theme_or not. There is not anything currently in the registry that would help "detect" if a module has overridden a template however, as this relies solely on the path to the template file (which cannot be reverse engineered).theme_, then we override the function normallybootstrap_HOOK().theme_, we can use the entire function as the theme hook to check for a file/function (i.e.bootstrap_path_breadcrumbs_breadcrumb()orbootstrap_menu_views_menu_link()).Comment #12
markhalliwellThis isn't going to happen.
Comment #13
davemybes commentedI recently hit this same issue and after trying (and failing) the solutions presented here and elsewhere, I came up with my own that appears to work. Apologies for posting on a closed issue, but people searching for this issue will find this first.
Using Bootstrap 7.x-3.10 and Menu Views 7.x-2.4, I created a theme override for bootstrap_menu_link in my custom theme's template.php. I copied the entire bootstrap_menu_link function and added in some code for Menu Views. The complete function is below and should be all you need to make this work. However, if you usedany extra wrapper classes or you enabled the View Title, you might need to add in some things to the code below. For me, all I wanted was the list items. I didn't use any arguments either, but I've included the code for that, just in case.
Comment #14
amaisano commented@incrn8 what is your code here attempting to check for, exactly:
I use a radix sub-theme and I've had to tweak some things to work with radix's *very* aggressive theme_menu() overrides.
When I used your code here it didn't really work, and I got "Warning: strpos(): Empty needle".
I changed it to be the following, but I'm worried that if normal, non-menu_views links are added things will get screwed up:
I'm confused on the use of '$bad_view' I suppose.
Comment #15
markhalliwellIt should be noted that the "solution" to get Menu Views and a theme that alters the registry too (like this one) is actually relatively simple. See: #1908910-33: View links are not displayed (rendered) in menu.