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.
Grants or denies access based on whether the context specified in the settings form is set.
Strikes me that it's primarily useful for when you have optional url args (!arg) and want variants based on whether or not the arg is specified without having to make two separate pages.
Comment | File | Size | Author |
---|---|---|---|
#7 | context_exists.inc_.txt | 2.57 KB | brynbellomy |
#6 | context_exists.inc_.txt | 2.54 KB | brynbellomy |
#5 | context_exists.inc_.txt | 2.58 KB | brynbellomy |
#3 | context_exists2.inc_.txt | 2.41 KB | brynbellomy |
context_exists.inc_.txt | 2.39 KB | brynbellomy |
Comments
Comment #1
sdboyer CreditAttribution: sdboyer commentedSimple enough and makes sense; let me have a look, and I'll likely commit.
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedThis does not pass a coding standards review. All if statements must contain { } to prevent errors in the future.
Comment #3
brynbellomy CreditAttribution: brynbellomy commentedFixed the {} braces and ran this through coder. Should be clean now.
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedHm. So for another purpose, I had to retool contexts such that optional contexts now provide an empty context when they do not appear. So this approach doesn't quite work right, now. And, in fact, opens it up to a much easier approach. Which I'm sorry about because now this needs to be redone.
Comment #5
brynbellomy CreditAttribution: brynbellomy commentedAlright, this has been fixed per your suggestions on IRC, I think. Happy to settle any other changes as well, though.
Comment #6
brynbellomy CreditAttribution: brynbellomy commentedWhoops, the hooks all still bore my name. Fixed.
Comment #7
brynbellomy CreditAttribution: brynbellomy commentedSigh. Multiple versions of this file are ruining my life.
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedReworked somewhat and committed.
One note of import: When using t() try to avoid using a / in the text, as it's harder on translators. So switch from using '' to "" if there is a ' in the text; only use / if you absolutely have to.