For a project I am working on this issue bugged me due to a couple of reasons:

  1. possible invalidation of caches, not recognizing caches (different urls, for same node)
  2. "bad" url style when someone right click open the link
  3. which will lead to bad urls spread by the current user and other modules (share this page for instance)
  4. issues with too many other modules that rely on a not modified url

Long story short - I implemented it: modified the javascript handling the colorbox and the views integration to use data-attributes instead of the query modification. The modified javascript still fallsback to the former query lookup routine (to not break different implementations not using views ui). If there's need for this feature and the module author is willing to integrate I could provide a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Andre-B’s picture

Issue summary: View changes

added the part about fallback

solipsist’s picture

I agree and it's exactly what I've done as I think using query params is a bit kludgy and poor semantics. Furthermore, it would be very nice to have a Ctools plugin that provides a panels selection rule that can be used set a panel variant that uses a layout plugin that is modal-friendly for serving up nodes when using Panels Everywhere.

Regardless of whether it will be implemented or not, providing a patch is always appreciated in the world of Drupal. So please post the one you made.

metastate’s picture

Yes, please post your patch. I don't like the idea of using query parameters either and am running into the bad urls problem you mention in #3 above (AddThis links in my case).

iLLin’s picture

#1 I would like you to prove the possible invalidation of caches, as the URL should always be ran through the "l" function as the system URL. It will fetch the appropriate alias on its on. This module will do nothing to effect that.

#2 Also, I don't modify the URL, so if you right click open, the link will be the right one but with width/height added as query parameters (I get that but I doubt its a problem). Its 2013...

#3 Again, I doubt its a problem as long as your URLS are consistent.

#4 I modify the URL with javascript. But I retrieve the correct path through the menu and fetch the content. I also allow other modules to call hooks against that content to alter it. Not sure what other modules are doing that "rely" on a URL, that seems bad practice. If you could give me some examples that would help.

Note: With this approach, then you couldn't rewrite the field, in views, into a link and change the width/height. There is no such data-attributes in the views rewrite section.

Andre-B’s picture

I really did not want to start a fight here or go too deep into detail, so I keep this short:

#1 just think of a Varnish for instance, it uses the uri to generate cache ids, so if you have a different uri, you have different caches. end of story
#1.1 do you want to have you urls indexed including the height and width settings? if not you will have to figure out how to do a global redirect to the actual url without the height and width stuff in url (which is +1 request at least, and I doubt that it will work without problems). seconds solution for this would be to use canonical, but why that much work if it cant be solved easily.

#2 this is a different uri, which might interfere with a lot of other things.

#3 think of a sharing button inside of the colorbox, what url will it take? the "good" one, or the "bad" one with that height and width information? this url will get probably spread across different networks then. is it a real problem? depends - for me yes.

#4 I cant, just thinking ahead.

Note: With this approach, then you couldn't rewrite the field, in views, into a link and change the width/height. There is no such data-attributes in the views rewrite section.

well I guess I got it working though. I will look at it later and diff the module against the current release and submit a patch.

iLLin’s picture

Not trying to start a fight, trying to have a good discussion as I have to cater to a lot of different experience levels. I tend to lean more on the inexperienced side as the more experience can do work arounds.

I like data-attributes as its cleaner like you suggest. I also firmly believe the internet is going more in that direction, especially with new tags. But, then it won't work easily with the views rewrite field. I could potentially "add to" the views rewrite section a data attributes field (not a bad idea).

If we went data-attributes, that should solve varnish.

#3 it seems we will be trying to share "colorbox/node/1" or w/e url launched. Thats a problem. I am thinking they fetch the URL from somewhere (maybe arg() ? ). I don't use the share this or add this as they are slow so I don't know what they do. We can address that since that is going to be a problem regardless.

What are you thinking as far as data-attributes? data-width, data-height?

Andre-B’s picture

patch against 2.6

metastate’s picture

Just a follow-up with my use case, although it's only partly relevant to this discussion. Maybe it will help other people in the future though, since this issue showed up in a search for AddThis.

I was having problems in line with Andre B's point #3 - in particular, AddThis not getting the proper url from a Colorbox Node popup. It was just sharing the home page as the URL. (I thought this was due to the query parameters at first, but it more likely has something to do with the way AddThis gets the url.)

Anyway, my workaround: I was adding the AddThis code via the node template (not a module) so I found a way to manually tell AddThis what the proper url should be: http://support.addthis.com/customer/portal/articles/125634-setting-the-u...

Andre-B’s picture

sure there will always be a way to define the "base" or "canonical" url of a site, but it usually introduces more work as needed :)

Andre-B’s picture

Status: Active » Needs review

any interest on this? patch is there :)

iLLin’s picture

Been working on my car lately, I'll get it in soon.

Andre-B’s picture

I bump on this again, hopefully this will get in soon :)

iLLin’s picture

I will get to it soon, I promise.

iLLin’s picture

Version: 7.x-2.6 » 7.x-3.x-dev
Status: Needs review » Fixed
Andre-B’s picture

Status: Fixed » Active

- cant attach files here, see next comment

Andre-B’s picture

FileSize
23.96 KB
64.92 KB

this release is bugged. I guess the change to underscroe in the data attributes name is causing problems: at least in chrome the views output for a rewritten field with data-inner_height and data-inner_width is printed as width and height only:
views output

the rewritten views output was defined as this:
views rewrite

Also I noticed that the colorbox trigger field in views is not yet using the new data-attributes.

Andre-B’s picture

changing from underscore to dash fixes this for me.

iLLin’s picture

OK I'll get it updated.

Andre-B’s picture

great thanks :) hopefully soon, this is critical - if people implement the "broken" way things get worst :/

iLLin’s picture

Committed to DEV http://drupalcode.org/project/colorbox_node.git/commit/9b79b97

Not sure what you mean by the views not working right? The views seemed to be working fine for me.

iLLin’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

clarification