I've got a test site setup with the following...
Drupal 7
Views 7.x-3.x-dev
Shadowbox 7.x-3.0-beta3
I created an image content type with an image field. While viewing the image field shadowbox appears to be working correctly. I can click on the image in the node and the shadowbox pops up.
However, when creating a view that filters by image nodes, takes a taxonomy term as an argument, and displays the image field I'm unable to get shadowbox working. I simply see my images and they link directly to the full image. None of it is taking place with shadowbox.
What I'm trying to do is create a gallery of images based on taxonomy term. I'm not sure if I'm going about this the right way or not. I figured with views however I should still see shadowbox functionality.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | shadowbox.module.zip | 4.71 KB | manfer |
| #12 | shadowbox.module.zip | 4.8 KB | manfer |
Comments
Comment #1
manfer commentedHave you tried generating the view and visiting the page that contains the view.
I have made I test and the problem seems to be it does not work in the preview that views generates. I can't figure out why. But after you efectively generate the view and visit it, the images shows as expected with shadowbox functionality.
I first thought about the shadowbox configuration parameter that allows only shadowbox in specific pages. By default it is excluding admin* paths. But, I have deleted admin* from the excluded paths and still not working on the view preview.
I have to try to figure it out a little more but there is the possibility to be a views issue (or views and shadowbox issue). The only difference I notice is that views is adding a class to the anchors in the preview:
and maybe that is preventing shadowbox to work on preview.
About if you are going on the right way. I think yes, you can do it that way. Please try to generate a view and visit that view instead of testing it in the preview and let me no if it works as expected.
Comment #2
caschbre commentedSorry for the confusion. I am looking / testing with the actual views page and not through the views preview.
One thing I noticed was that on the views page the only reference to shadowbox I find is on the link of the image.
rel="shadowbox[field_image]"
There is nothing else in the whole page that mentions shadowbox that I can find.
Now on the image node page I see reference to shadowbox all over the place with javascript, rel tags, etc.
I'm wondering if something is going on that is not loading the shadowbox functionality into my views page.
Comment #3
manfer commentedI understand that you first create an image content type to create image nodes. When you visit those nodes all works fine and images are displayed into shadowbox when you click the thumb. This content type besides can be categorized with some short of taxonomy.
Then you go and create a view for those node types, and you filter the nodes by taxonomy too. I really don't know if there is any view where you can provide just that. In the view I'm testing I have to configure the fields that are going to be shown too.
So one of the fields I have to configure is the image field itself. On that field I have to ensure I choose shadowbox as the formatter to display that field (otherwise the view will not use shadowbox).
Could be this what you are mixing? How do you configure the fields section of your view?
Comment #4
caschbre commentedIn the view I am displaying the Fields: Image and then selecting shadowbox as the formatter.
The view export is below if that helps. I'm sort of at a loss.
Comment #5
manfer commentedI can't see anything wrong in that configuration. About the field configuration I only can't find any place to configure the following one. I really don't know which is this setting.
In my test the only different is that I have no filter criteria other that node type image. But all those filters, including the parametrized taxonomy looks fine and they are only going to reduce the number of nodes on the view, should not have any to do with the display formatter shadowbox.
Besides if I understood correctly your view shows images but the problem is that shows only the thumbnail (medium size is what you have configured) and when you click instead of the shadowbox it appears in the window.
Maybe the problem is that the library is not being included in your page for some reason and having nothing to do with the view. It would be helpful to see a testing site online to inspect the code. Otherwise I only can tell you how to test if shadowbox library is on those pages. If you know how to use the console on developers tools of your browser (firebug in firefox, the integrated tools in chrome and I think IE7 and above -or at least IE8- has tools too), go to that console and write Shadowbox and hit run, if the response shows an object:
then shadowbox library is working on the page.
On an online test site I can do those kind of checks.
Comment #6
manfer commentedI have just done a test with taxonomies as arguments and works fine too for me. So if the view displays the images correctly, the ones corresponding to the term you are visiting, but they are not being displayed in shadowbox when you click on them, it is better to first check if shadowbox library is being loaded.
Comment #7
caschbre commentedWhen I run Shadowbox on the image node I get the object you mention. When I try that on the views page it cannot find the reference.
I also shot you a URL via the contact form of a site to look at.
Comment #8
manfer commentedNothing more I can imply from the testing site.
As you already checked Shadowbox object is not present in the view page. This indicates that shadowbox library is not being loading. Checking it I see it is not loaded indeed.
Now why is this happening is what needs to be understood:
- The error console does not report any error. The problem is not any javascript error then.
- So all must come from PHP. The server is not sending shadowbox library as part of that page.
- In shadowbox configuration /admin/config/media/shadowbox you have settings to include/exclude paths where you don't want shadowbox to be used, "page specific activation settings". By default it excludes admin*, img_assist*, node/add/* and node/*/edit. You should check if you changed something there that could be excluding your view path.
- Check too that the "Enable Shadowbox" checkbox in that same configuration page is checked.
- Being there just check too that clicking "check Shadowbox with the current settings" opens shadowbox.
If nothing of that works then I can't figure out yet why shadowbox is not being loaded.
Comment #9
caschbre commentedEnable shadowbox is checked.
The include/exclude path settings are the defaults as you have listed.
Check shadowbox with current settings does indeed work.
Any other suggestions on how I could debug this?
Comment #10
manfer commentedYou confirm the path settings are correct in the text area but above that you have 3 radio buttons: "Enable on every page except the listed pages.", "Enable on only the listed pages.", "Enable if the following PHP code returns TRUE (PHP-mode, experts only).". (this last one only appear if you have enough permissions).
The correct one that must be checked is "Enable on every page except the listed pages."
If you confirm you have that correctly configured then I would need to attach here a version with debug code to try to figure out why the shadowbox library is not being loaded.
Comment #11
caschbre commentedHere are the settings.
Enable on every page except the listed pages.
admin*
img_assist*
node/add/*
node/*/edit
Interestingly enough, I don't see the "Enable if the following PHP code returns TRUE" option. I'm guessing only user #1 can see that option? I currently have every permission checked for my role on the user permissions page. But I'm guessing that alone isn't the issue.
Comment #12
manfer commentedThe PHP option is only available for users with "Use PHP for settings" permission and that permission is only available if PHP filter core module is enable but has nothing to do with the issue.
The configuration is correct.
I attach a zip with shadowbox.module file that includes some debug code. Please install it over your actual shadowbox.module file and let me now the output when you visit one of your working image nodes and when you visit the view page.
Comment #13
caschbre commentedWorking image node page.
Views page
Comment #14
manfer commentedAll looks correct. There must be a conflicting module creating this issue.
By now, you can revert the shadowbox.module file to the one included in the shadowbox module and use the auto handling feature "Enable shadowbox globally". You can find it under /admin/config/media/shadowbox/automatic. With that setting your views pages will work with shadowbox while the conflicting module is being tracked.
Comment #15
manfer commentedI have released a beta4 with a minor change. I'm not sure if this could be affecting in your case. It would be helpful if you could try this beta4 with the auto handling feature "Enable shadowbox globally" disabled.
I'm unable to reproduce the issue so I can't test if the change made in beta4 solves it.
Comment #16
caschbre commentedI'll try to give this a shot tonight or over the weekend and report back what I find.
Comment #17
caschbre commentedUnfortunately the upgrade didn't solve the issue. :(
Comment #18
manfer commentedIs the test site still online to do other test? To know if this has something to do with a hacked theme it would be nice to test if changing the theme to other core theme and configuring shadowbox without "Enable shadowbox globally" checked, the issue remains present or not.
If still present I append another shadowbox.module with minor changes. In that new file I'm attaching shadowbox library a level deeper. Let's try if this works. I wonder if any module is just overwriting the '#attached' attribute instead of appending to it which is what should be done I think. With this change maybe shadowbox '#attached' attribute is not overwriten. This will give me the answer though I don't know if I'm going to be able to track which module. To do this test you would have to change your shadowbox.module with this version and besides, as on the rest of test, disable the checkbox "Enable shadowbox globally" in shadowbox auto handle configuration.
Comment #19
manfer commentedComment #20
caschbre commentedI checked the theme out and there are no modifications to it. I also tried another core theme and still had the same issue with shadowbox.
I'll install the new copy you attached and give that a run.
Comment #21
caschbre commentedThe module attached in #18 did the trick.
Comment #22
manfer commentedThanks a lot.
What I can imply of your tests, is that the theme was not the problem so it has to be a module.
A module must be overwriting my attached attribute that adds the shadowbox library to the page. That module must be doing something like.
['#attached']['library'] = array xxxxxxx (overwriting)
instead of:
['#attached']['library'][] = xxxx (appending)
But I have no clue which module. I have tested the list you let me gather from your site but with default values the problem is not appearing for me. So I can't know which one is the cause. The only way to find out which one is the problematic module would be to revert shadowbox to beta4 version and disable all modules instead of core ones and shadowbox itself and then enabling the other modules until the problem appears.
Anyway I'm going to try to ask in field API forum to confirm I'm attaching the library correctly or if it is better to turn to the code in this last version than you confirmed is working. Maybe I doing it wrong and is better this last code.
Thanks.
Comment #23
process91 commentedThis same thing happened with my site. The attached file from #18 also fixed it on my site. I'd be happy to provide debug information for you to cross-reference.
Comment #24
manfer commentedI have send a question to field core system to try to determine if actual code is wrong and would be better to change it to the one in #18 or to something totally different but still not answer.
If actual code is correct then there is another module with a bug that affects shadowbox. Really I don't know how to debug so deeper to find who is that module overwriting shadowbox code, if any. I could think of views itself but in my test site with shadowbox and views, works fine without any modification on shadowbox.
I will continue investigating this.
Thanks.
Comment #25
manfer commentedMaybe someone with good knowledge of field core system in drupal 7 comes to this issue and is able to answer the question I made in drupal core. Here is the issue:
http://drupal.org/node/1091076
If someone is able or knows anyone able to answer that question, it would be really helpful.
Thanks.
Comment #26
manfer commentedI had no luck with my question about this issue but as this other way to add the library looks fine for me too and corrects this issue with views, I decided to include this change in the new version 7.x-3.0-beta5.