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.
"Let's say I have a field on a node, 'color', and I want to find other nodes with the same color in a block."
Comment | File | Size | Author |
---|---|---|---|
#9 | views-1182808-9.patch | 2.84 KB | tim.plunkett |
#6 | views-1182808-6.patch | 2.83 KB | tim.plunkett |
#3 | views-1182808-3.patch | 2.69 KB | tim.plunkett |
#1 | views-1182808-1.patch | 2.59 KB | tim.plunkett |
Comments
Comment #1
tim.plunkettThe strings need work.
Choosing 1 in the select results in arg(0).
Comment #2
dawehnerThat's a valid task :)
Comment #3
tim.plunkett"Path component" seems to be the best label, it made sense to the 3 people I polled for a better string :)
I hope the description is helpful, not as attached to that. It clarifies what's happening here, but might cause confusion in contrast to
arg()
Comment #4
dawehnerSo the question is do we start at 0 or 1
That's wrong, you want index -1 according to your description.
Powered by Dreditor.
Comment #5
tim.plunkettGiven "admin/structure/types", arg(2) == 'types'.
range(1, 10)
generates an array likeSo selecting 3 in the interface will pass 2 to arg(), magically avoiding the 0-based confusion for end users.
...right?
Comment #6
tim.plunkettNow with code comments to alleviate the above confusion.
I'm up for backporting this, once it's in.
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedThis isn't an appropriate comment for doxygen, which should be explaining what the function/method does with a one liner and then a deeper explanation. For inherited methods doxy isn't really needed. The comment should be inside the funciton.
The #description should explicitly say that numbering starts from 1, and then follow with the e.g
Just doublechecking. ARe you sure we check plain the argument? I don't *think* we assume that arguments are safe since they're user input.
Comment #8
tim.plunkettComment #9
tim.plunkettYou were right, check_plain() breaks it for special characters, so I removed it.
I hope the new comments were what closer to you wanted? If not I guess we can work it out in IRC tomorrow.
Comment #10
joachim CreditAttribution: joachim commentedMaybe use a better key here...? 'Path component' is clearer than raw, we could use that in the code as well. Or am I nitpicking?
Powered by Dreditor.
Comment #11
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted to 7.x-3.x. Needs porting to 6.x (should just be the parentage change) and can go there too.
Comment #12
dawehnerBackported some time ago.