The breadcrumb is not right when you use tokens like '$node' or '$user' in the url. We've added a hook to create $group for OG groups and that comes through literally as '$group' in the breadcrumbs, and I see the same problem when using anything but '$arg' in the url.

I found a method that will correct this. Patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

KarenS’s picture

Bump. This patch is needed for OG calendar views to work correctly.

kc1981’s picture

A similar patch needs to be applied to the views_get_url() function beginning around line 710 for the iCal feed to have the proper URL on OG Calendar views.

moshe weitzman’s picture

views_bookmark will soon be implementing this url_token. reviews are needed here.

will_in_wi’s picture

Subscribing

ajayg’s picture

subscribing

ajayg’s picture

Status: Needs work » Needs review

IS there any argument handling code required to make this work? I used this patch but not sure this is working. How can I verify it is working?

Does this apply to "$group" token as well in URL? I applied the patch hoping this fix this issue
http://drupal.org/node/257088

with no luck. Still the $group is not substitued correctly in URL.

Atleast one more person other than me confirmed (http://drupal.org/node/201718) the patch does not work for $group token.

ajayg’s picture

Status: Needs review » Needs work
will_in_wi’s picture

Status: Needs review » Needs work

I fixed it for calendar with this patch:
http://drupal.org/node/239594

ajayg’s picture

I just used "$arg" as argument as a workaround, instead of this patch (since patch did not work for me) and it worked.

KarenS’s picture

$arg will work but you'll lose the special processing $group gives you -- $group checks if the node is a group node or not so the tab is only attached to group nodes. If you use $arg you'll see a tab on every node.

I haven't had time yet to look at the Calendar patch, but I'll get to it soon.

ajayg’s picture

FileSize
1.99 KB

As superkc9 mentioned a change in function views_get_url was required. This is a cumulative patch which combines both the patch by KarenS above and changes to views_get_url
(my first multiline patch at drupal.org, so please guide me if I have done something wrong)

ajayg’s picture

Status: Needs work » Needs review

@KarenS Thanks for the issue with using $arg instead of $group. The patch I submitted above now takes care of it. Atleast it took care of it for me unless I missed something. Appreciate your comments.

derhasi’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
2.11 KB

I added some lines, due to missing replacement. For example for /node/$node-nodetype/list only $node was replaced, instead of $node-nodetype.

foreach ($tokens as $token) {
          if ($where = strpos($url, $token)){
			$to = strpos($url,"/",$where);
			$to = ($to)?$to-$where:strlen($url)-$where;
            break;
          }
      }
      if ($where){
          $url = substr_replace($url, $arg, $where, $to);
      } else {
          $url .= "/$arg";
      }

Complete patch attached!

dugh’s picture

Nice, and to fix the 'next' and 'prev' links in calendar views, see: http://drupal.org/node/239594

sun’s picture

Status: Reviewed & tested by the community » Needs work

Last patches violate coding standards (wrong indentation). Please re-roll.

pathfinderelite’s picture

Status: Needs work » Needs review
FileSize
1.88 KB

Here is the patch from #13, but properly formatted. I created this patch off of Views 5.x-1.6

WorldFallz’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
2.01 KB

Rerolled patch from #16 against current dev-- fixes the problem and works great with $arg and $group as arguments. Should be good to go.

esmerel’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

At this time, only security fixes will be made to the 5.x version of Views.