Download & Extend

Impossibly to use block visibility php-code

Project:Node breadcrumb
Version:6.x-1.0-beta2
Component:Code
Category:bug report
Priority:normal
Assigned:edhel
Status:closed (fixed)

Issue Summary

subj

Comments

#1

This issue lacks a description, but I figure it concerns the same issue I was having:

It is impossible to use Block Visibility rules on nodes mapped by node_breadcrumb. This is true for the include/exclude paths and the PHP condition.

The reason is that the module changes the value of $_GET["q"]. In effect it fools Drupal's menu system in thinking it's actually showing a different page.

So when you try to determine the current node, it returns the node of the page it is attached to - not the node itself.

I could not wait for a general fix, so I hacked one myself.

Open the file node_breadcrumb.module and do the following change

function _node_breadcrumb_set_location(...) {
  $path = $_GET["q"]; // <-- add this line to store current path
  /* Normal code goes here untouched */
  $_GET["q"] = $path; // <-- add this line to restore current path
}

I hope someone finds this useful!

#2

dynamind, this code fix block visibility rules, but we lost menu location of nodes

#3

Status:active» fixed

fixed in beta3

#4

Status:fixed» closed (fixed)

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

#5

it is still overwriting $_GET['q'] to be the last breadcrumb path. is that a by-design thing? it's turning up as a problem all over my theme code, which does things based on the current path. scratch that - i didn't realize that dev was older than the beta releases.

nobody click here