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.
Currently the subscriptions table of checkboxes will skip over table rows if #access is not TRUE for that group of checkboxes, however it doesn't take into account #access in the individual checkbox elements within the groups.
So if I make a custom module that restricts specific checkboxes then it doesn't work properly.
Comment | File | Size | Author |
---|---|---|---|
#7 | subscriptions-support_individual_checkbox_access-2518700-7.patch | 2.77 KB | rooby |
| |||
#2 | subscriptions-support_individual_checkbox_access-2518700-2.patch | 1.24 KB | rooby |
Comments
Comment #1
rooby CreditAttribution: rooby commentedActually technically this is a bug because #access is pert of the drupal core form API so it really should be supported.
Comment #2
rooby CreditAttribution: rooby commentedHere's a patch that helps for me. I have only tested my use cases so far but it should work for all use cases.
Comment #3
salvisPlease post a screenshot of what you're trying to accomplish.
Have you considered using #disabled rather than #access?
Comment #4
salvisComment #5
rooby CreditAttribution: rooby commentedActually I found a problem with that patch.
When I upload a new one I'll also address your previous questions.
Comment #6
rooby CreditAttribution: rooby commentedComment #7
rooby CreditAttribution: rooby commentedI have a module that overrides the subscribe form in certain cases and restricts access to certain subscribe options.
For example, I might want to restrict access to subscribing to comments at the node type level but not the node level or something along those lines.
In terms of the form API this is a valid thing to do but currently this isn't possible due to the way the subscriptions table theme function handles #access.
#disabled != #access
Here is an updated version of the patch that adds the ability to restrict access at the cell level and properly handles:
Comment #8
salvisThis is not doing what you think it is, because your $col_indexes are not column indexes (IOW, your name of the variable is bad!). Your condition is never true and your 'if' only hides the bug.