Hi,

When I set the node gallery to be a standard group post, and create a node gallery in my group, I found that:

1) on the full node page ( node/[nid]/ ), and node edit page ( node/[nid]/edit ), the breadcrumbs are:
Home » Groups » [mygroup]
2) on the sort image page ( node/[nid]/sort ), and manage images page (node/[nid]/images), and upload new images page ( node/[nid]/upload ), the breadcrumbs are:
Home » Gallery List » My Galleries

I know the breadcrumbs on pages listed in 2) are set by node_gallery module via
function node_gallery_set_breadcrumb()

However, is there a way to make the breadcrumbs more consistent when integrating with OG module?

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

justintime’s picture

Category: support » feature
Status: Active » Needs review
FileSize
10.29 KB

I have no way of testing locally, but I have a hunch this may be the way to do it. This patch will only attempt to fix the breadcrumbs on the sort tab. If it works, let me know and I'll do the same with the upload tab.

foredoc’s picture

Thanks for your help. After applying the patch, seems the problem does not get solved.

However, I am not sure if the patch is applied successfully, since I got the message during patching:

Patching file node_gallery.module using Plan A...
Reversed (or previously applied) patch detected! Assume -R? [n]

Each time, I press "Y" to get it going.

Sorry if I did not apply the patch correctly.

Thanks again.

justintime’s picture

Jeez, sorry about that. I attached the wrong patch. You'll probably want to start with a fresh dev build since the "Assume -R" question you said yes to removed code from your install.

foredoc’s picture

I applied the patch in #3, now the breadcrumbs for node/[nid]/sort becomes:

Home » [node_title], here [node_title] is actually the gallery name.

Is this the desired behavior of the patch?

To keep the consistency with node/[nid]/, and node/[nid]/edit, I think the breadcrumbs should be:

Home » Groups » [mygroup]

or even better:

Home » Groups » [mygroup] » [mygallery]

Thanks again, and I appreciate your help.

justintime’s picture

Status: Needs review » Needs work

Nope, that wasn't what was desired. I was hoping to hit the latter of your needs. I'll have to setup a dummy OG install and tinker with it.

justintime’s picture

@foredoc, what did you do to get breadcrumbs that way in the first place(on the view/edit tabs)? Are you using custom_breadcrumbs or something? I can't duplicate that on my sandbox.

foredoc’s picture

I am not using custom_breadcrumbs. What I did:

1) set node_gallery_gallery, and node_gallery_image to be standard group post
2) create a node_gallery_gallery node in [mygroup]

After doing this, on the view/edit tabs of the gallery node, I will have breadcrumbs like:

Home » Groups » [mygroup]

Just as for all other standard group post.

I am not sure if this answers your question.

Thanks.

justintime’s picture

Do you have some pathauto preferences set? I followed your instructions, and still don't have any breadcrumbs like yours: http://live.justintime.gotpantheon.com/

foredoc’s picture

This is very strange. I do not have pathauto installed.

My experience:

When I post a node within a group, and on the node view/edit page, the breadcrumbs will always be:

Home > Groups > [mygroup]

It happens to me by default. And my guess is that, on the node view/edit page of a group post, the group context will be set by og module, then the breadcrumbs will be taken care of by og module.

Do you have similar breadcrumbs as mine, for other type of group post? Say, story?

Thanks.

justintime’s picture

Status: Needs work » Needs review
FileSize
5.66 KB

Think I got it this time....

justintime’s picture

One more for a little more cleanup.

foredoc’s picture

This is great! I have tested the patch in #11, and it works well.

@justintime, thanks very much for your effort.

I may have another request here,

Since I have set the node_gallery_image as standard group post, when I browse an image inside a gallery, which is posted in my group, the breadcrumbs look like:

Home > Groups > [mygroup]

It will be great if we can also put the gallery at the end when browsing an image:

Home > Groups > [mygroup] > [mygallery]

Also, will this great patch be ported into 6.x-3.0-beta3 ?

Thanks again!

justintime’s picture

Attached patch:
- Does the requested features in #12
- Fixes a bug where the cascading of og settings didn't work on a newly created gallery and uploading images using plupload.

One note, the Group page was pretty cluttered with images, I preferred to only see the galleries on the group page. Simply editing the og_ghp_ron view to filter out node_gallery_image content types worked perfectly.

Yes, my plan is to finish this up for beta3 so we can "advertise" OG compatability.

foredoc’s picture

Thanks for the great suggestion, that is exactly what I did.

Have a quick test of the patch in #13, and find following problems:

Suppose I have a group: mygroup, a gallery in this group: mygallery, and an image in this gallery: test.jpg (uploaded via plupload)

on the view tab page of this image:

Breadcrumbs: Home > Groups > [mygroup]
I expect: Home > Groups > [mygroup] > [mygallery]

On the edit tab page of this image:

Breadcrumbs: Home > Groups > [mygroup] > test.jpg
I expect: Home > Groups > [mygroup] > [mygallery]

Thanks again.

justintime’s picture

I noticed that too. I'll see what I can do, but that one one be so easy to do since the function I've been working on isn't called on the edit form there.

For reference, when you view a gallery, you see: Home > Groups > [mygroup]

But when you edit the gallery, you see: Home > Groups > [mygroup] > [mygallery]

So, extrapolating that to gallery images would give you Home > Groups > [mygroup] > [mygallery] > test.jpg

when you visit the edit page.

justintime’s picture

I guess I'm on a roll :)

This should fix the edit tab breadcrumbs.

foredoc’s picture

Just applied this patch, and got the same result as via #13.

For the gallery image view tab page:

Breadcrumbs: Home > Groups > [mygroup]

For the gallery image edit tab page:

Breadcrumbs: Home > Groups > [mygroup] > test.jpg

Thanks.

justintime’s picture

Odd, it's working for me. Can you try creating a new gallery with new images within the group, and test the patch on that?

foredoc’s picture

It is the same for a new gallery and new images inside.

My approach:
1) apply the patch on a newly downloaded NG 6.x-3.0-beta2
2) create a gallery, with og audience to be mygroup
3) upload images to that gallery via plupload, and visit the image edit page, set og audience to be mygroup (since I did not apply the og cascade patch, I need to manually change the og setting for each image )

@justintime, you see any problems here?

Thanks.

justintime’s picture

There's something odd going on with the code that cascades down to the images. I have a hunch that it has something to do with editing the images and saving them with that og form element hidden. I'll have to look into it later.

In the meantime, try editing the parent gallery, remove the group checkbox, then re-edit and check the box. Then see what your breadcrumbs look like.

I've installed a sample OG setup on the demo site, we can verify we're talking about the same things there. Here's what I'm seeing happen that I think is what you and I are shooting for:

http://live.justintime.gotpantheon.com/galleries/group-1-gallery-2/sampl...

justintime’s picture

Attached patch fixes the bug I mentioned in #20, and appears pretty stable to me. If you're having issues, either re-save the images or toggle the group checkboxes on the gallery.

foredoc’s picture

FileSize
87.99 KB
100.83 KB

With patch in #21, I still can not have it work, even if I re-save the images or toggle the group checkboxes on the gallery.

And it is the same no matter I apply og cascading patch or not. (http://drupal.org/node/1159306#comment-4496032)

Thanks.

foredoc’s picture

I think I have figured out the reason for this: the relative weights of og module and node gallery module in {system}.

After resetting the weight_of_NG > weight_of_OG, it works as desired.

My guess is that, by setting weight_of_NG > weight_of_OG, the breadcrumb handling by NG comes after the handling via OG, which leads to the desired results.

To verify this, I changed the weights: weight_of_NG < weight_of_OG, then it re-produces the problem I had before.

@justintime: could you please double check if this is the case?

If it is,

1) do we need to make sure NG has larger weight than OG in {system} ?
2) is there other ways rather than play with the weight?

Maybe we also need to document it.

Thanks a lot.

justintime’s picture

FileSize
120.27 KB

Well, I didn't change the weight on my install, so OG should be after NG alphabetically on my install.

I did remember that I had setup pathauto, and I think that may be helping my install out. Try doing what I've done in the screenshot after resetting your weights back to zero.

foredoc’s picture

I reset weights back to zero, and tried pathauto with the settings in #24, still does not work.

The only way, so far, works for me is changing the weight.

@justintime, could you reset the weight of NG to be -1, while keep your pathauto setting, to see if you can reproduce my problem ?

Thanks.

justintime’s picture

Yeah, tweaking the weight reproduced the problem. I *hate* mucking with module weights, because there's so many edge cases (install og first, install ng first, disable one, re-enable it later, etc).

I'll debug it later tonight and see if I can find a way around it.

foredoc’s picture

Great! Thank you very much, and I am really sorry to drag your feet for such a long time :(

justintime’s picture

I really don't want to go changing NG's module weight in the release just before an RC -- we integrate with too many other modules and changing the weight programmatically may break other integrations.

Instead, I added a check for this condition in hook_requirements, that will show some text to the admin when OG is heavier than Node Gallery. I would appreciate if you can test that this works properly by visiting admin/reports/status and proofread what I've got there, and make sure it goes away when you fix the weights.

foredoc’s picture

This patch works properly, and the description on the status page looks clear to me.

One little thing, In my theme, all messages in admin/reports/status page starts with an icon, except the message from NG, as shown in attachment.

Thanks.

foredoc’s picture

FileSize
12.49 KB

forgot to attach the picture.

justintime’s picture

Status: Needs review » Fixed

That's actually by design. I used a status of INFO, to try and attract some attention. However, it's not technically an ERROR or WARNING, because the admin may not use NG with OG, but have the modules enabled. If I would have used OK, I would have got a check, WARNING or ERROR would have given a X icon. INFO just gets me a neutral blue with no icon :)

Committed this into 6.x-3.x-dev.

foredoc’s picture

Status: Fixed » Needs work

I read the description again, and feel some confusion:

Currently when I have NG weight < OG weight, I will have a message on status page, saying:

OG has a lighter weight than Node Gallery

Should we say:

OG SHOULD have a lighter weight than Node Gallery ?

Or

OG has a greater weight than Node Gallery ?

Thanks

justintime’s picture

Status: Needs work » Fixed

Good catch. Changed the text and pushed to 3.x-dev.

Status: Fixed » Closed (fixed)

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