Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi everybody,
I wrote a small Krumo plugin that shows the PHP path when clicking on a Krumo node. This way you can quickly copy the variable path for use in your module / theme. Requires jQuery version >= 1.3.
Let me know if you like it!
Comment | File | Size | Author |
---|---|---|---|
#49 | krumo_path_plugin.1192616.47-followup.patch | 1.03 KB | dvessel |
#47 | krumo_path_plugin.1192616.47.patch | 3.05 KB | DongIT |
#46 | Devel_Krumo_hint.png | 6.53 KB | salvis |
#45 | hint.png | 8.6 KB | DongIT |
#43 | krumo_path_plugin.1192616.43.patch | 4.58 KB | DongIT |
Comments
Comment #1
salvisThe normal click is already used for expanding/collapsing a node, and I'm not so happy to force this functionality onto everyone, wasting precious screen space to display clutter that is useful only occasionally.
moshe has written before that he would like to have krumo replaced by our own implementation. What do you think, moshe?
IAC, new features have to go into 7.x-1.x-dev first. And please, increase your chances for anyone to look at your uploads by posting them expanded.
Comment #2
DongIT CreditAttribution: DongIT commentedOk, I've changed the path only to display on a right click event on the Krumo node. So the precious screen space is preserved. Also changed the code a little and attached a Drupal 7 version.
Comment #3
salvisRight click is much better, thank you. Now post a D7 patch instead of a zip file, please.
Comment #4
DongIT CreditAttribution: DongIT commentedAttached a D7 patch.
Comment #5
salvisComment #8
salvisPlease change all tabs into two spaces and remove all trailing spaces.
I can't remember what version we have in D7. Please check and remove the comment if ours is new enough.
Please remove this. Your authorship ('DongIT') will be documented in the commit message, but other than that we don't put names and website ads into our code.
Comment #9
DongIT CreditAttribution: DongIT commentedRemoved trailing spaces, changed tabs into spaces and removed authorship.
Comment #10
salvisThanks!
Comment #12
rfayPlease use git to create your patches, and all patches must now be -p1. Here's a reroll. Not sure why the status didn't explain that this was a -p0 patch and that's why it failed.
This is the same patch rerolled with git diff.
Comment #13
salvisIt doesn't make sense to add the .js file if this function returns FALSE, does it?
Comment #14
DongIT CreditAttribution: DongIT commentedNo it doesn't :) Please verify the attached patch.
Comment #15
salvisComment #16
DongIT CreditAttribution: DongIT commentedSorry I just noticed I submitted the wrong version of my patch. This should be the correct one.
Comment #17
DongIT CreditAttribution: DongIT commentedMy patching skills need some work, sorry. This should (finally) be the correct patch.
Comment #18
salvisNo problem. The first few patches are tough to get right, but I'm sure you'll get the hang of it.
100644 is the usual file mode. Why do you change this?
The http://drupal.org/coding-standards call for 2 spaces per indent level and no tabs.
@rfay: Shouldn't the testbot have caught this?
100644 — the files shouldn't be executable.
@rfay: Another task for the testbot?
Maybe add a newline at the end for good looks.
Comment #19
DongIT CreditAttribution: DongIT commentedNot sure why the file modes were changed. Changed the file modes, tabs/spaces and added the newline.
Comment #20
rfay@salvis, @DongIT, the reason the file mode gets changed is that some git clients have core.filemode turned on. And then you get a cross-platform situation where the two platforms disagree on what modes are "normal".
So if everybody would do
that will solve the situation.
Since devel has no tests, the testbot didn't do anything. And it doesn't care about filemodes either, just about whether simpletest runs successfully. And unfortunately, the coder component built into the testbots has never been deployed. So coder checks don't happen.
Comment #21
moshe weitzman CreditAttribution: moshe weitzman commentedActually, I committed devel's first test last week. http://drupalcode.org/project/devel.git/blob/refs/heads/7.x-1.x:/devel.test
Comment #22
salvisOur first test, yay!
Thanks, Randy!
Oops, now you've introduced a trailing space, which makes this line different from what it was before. We're trained to watch out for these things (among many others of course)...
But never mind, I'll take care of that. Let's mark it NR and see what the testbot says now.
Powered by Dreditor.
Comment #23
salvisEDIT: deleted duplicate post.
Comment #24
salvis(weird — there seems to be some kind of caching problem...)
Comment #25
salvis(after submitting my #24 I've again seen comments up to #21 only! after a refresh I'm seeing them through #24)
Comment #26
salvisThe right mouse button is not working for me because the browser uses it for showing the context menu of the page.
Here's an attempt to use double-click instead (and I've also done a bit of coding style cleanup). It works reasonably well for me with Firefox.
The functionality is a hidden feature. It would be nice to advertise it discretely, without adding undue clutter or overhead. I don't have any good idea though...
I'm not fluent in jQuery and I don't see core using
anywhere. Is this the correct idiom in the Drupal world?
Comment #27
salvisComment #28
rfay#26: Yes, I'd say that Drupal.behaviors is the correct way to add javascript behavior in D7. http://drupal.org/node/756722
It would be very unusual to use .read() any more.
Comment #29
DongIT CreditAttribution: DongIT commentedAdded drupal.behaviors, please verify
Comment #30
salvisOops, I posted the wrong patch — the one with the right-click, which is eaten by my browser (FF) to show the page's context menu.
Here's an updated version with the double-click instead of the right-click. What do you think of this?
Comment #31
DongIT CreditAttribution: DongIT commentedI think the double click is ok. Better than the right click as the appearing right mouse menu can be annoying. However, when a krumo node is already opened, when double clicking on it to show the path, the node first closes and opens again with the path. It would be nicer if just the path would appear. But I don’t think this open-close thing is an issue.
Comment #32
salvisOn my FF 3.6 the right mouse click is not passed on to JS at all, i.e. the node doesn't toggle, only the context menu opens.
The expanding/collapsing of the node along with the path toggling occur as you describe. Does anyone have an idea how to avoid it?
And I still would like to see a way to advertise this feature discretely. Any ideas?
Comment #33
DongIT CreditAttribution: DongIT commentedPerhaps a combination like control + left mouse click?
Comment #34
salvisNo, control + left mouse click is too obscure IMO.
Added missing comment, adjusted indenting to match Drupal's coding style, fixed last line to be
rather than
In the Core code I see only the latter. It's weird that both seem to do the same thing...
(Did I say I wasn't fluent in jQuery? Can someone explain this?)
I'm not sure what the correct name and location for the krumo_path.js file is. Should it be called devel.krumo_path.js? Should it go to the krumo directory?
Comment #36
salvis#34: krumo_path_plugin.1192616.34.patch queued for re-testing.
Comment #37
DongIT CreditAttribution: DongIT commentedLooking at the other files, the correct file should be named devel_kumo_path.js. The JS file should not go in the Krumo dir, because all files in this dir belong to the orginal Krumo project. The modules root dir is ok.
By the way, right click could still be used even if you're using right click for your context menu: http://api.jquery.com/event.stopPropagation/
Comment #38
salvisIt's not me using right-click for my context menu. Firefox/Win eats the right-click and displays it's context menu. The right-click doesn't get through to jQuery, AFAICS.
Comment #39
DongIT CreditAttribution: DongIT commentedI'm on Windows with Firefox, I don't have any problems with the right click version. But double click is fine.
Comment #40
moshe weitzman CreditAttribution: moshe weitzman commentedCan we add a help icon (like the modules page has on some rows) to each level and show the path when someone clicks on that?
Comment #41
salvisHmm, adding something to every row is not so pretty, especially because there are different Krumo themes that it would have to work with.
But maybe we could add the help icon at the bottom left (to the left of 'Called from') and provide a title (mouse-over hint) there, something like: "Click to expand element, double-click to show path." Is that possible in JS? It would be nice if we didn't have to change Krumo...
Do you agree with DongIT in #37:
Comment #42
DongIT CreditAttribution: DongIT commentedI’ve added title tags that shows one of these hints:
Click to expand. Double click to show path.
Click to expand. Double click to hide path.
Click to collapse. Double click to show path.
Click to collapse. Double click to hide path.
Double click to show path.
Double click to hide path.
I’ve added a screenshot with 3 examples (my mouse pointer is missing in the screenshot).
Comment #43
DongIT CreditAttribution: DongIT commentedAccidentally used tabs in the above patch, converted to spaces.
Comment #44
salvisPlease let's try to discuss possible solutions before putting time and effort into code.
I've tried to give some direction in #26...
... and I'm concerned that the latest patch is
Every user would like to see the "Click to expand element, double-click to show path." information exactly once in his lifetime (ideal goal, not to be implemented verbatim). After that it's only a distraction, and the less he sees of it, the happier he is. If he can't figure out that clicking again will collapse the element, then he really should not use Devel.
No one, at least no one in the target group for Devel, will need any of the five other strings, or even take the time to contemplate all of them, except possibly to complain that they can't be translated.
Moshe hasn't commented on your #37, so I think...
... should be the way to go.
Comment #45
DongIT CreditAttribution: DongIT commentedThe only other more discrete and more 'efficient' option I can think of is by adding a message to the bottom of krumo (screenshot).
Comment #46
salvisHow about this (with the mouse hovering over the question mark icon from the modules list page)?
Is this possible, maybe even without touching the files in the krumo directory?
Comment #47
DongIT CreditAttribution: DongIT commentedGood idea, check the patch.
Comment #48
salvisAh, very nice! Committed to D8/D7.
I've changed the file name according to #37, removed the trailing spaces, fixed the file mode, and added a hyphen according to this discussion.
Thanks for pulling this through!
Comment #49
dvessel CreditAttribution: dvessel commentedTiny patch fixes the hard linking of help.png. It was giving errors in my server log since my install is in a sub-directory. Also added a missing semi-colon.
Comment #50
salvisCommitted to D8/D7. Thanks!