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.
When there are no realm keys in a realm, the realm switcher shows, despite there being no options in it. A PHP warning is also thrown.
The attached patch stops the form switcher being displayed when there are no realm keys to display.
Comment | File | Size | Author |
---|---|---|---|
variable-hide-empty-realm-switcher.patch | 1.36 KB | james.williams | |
Comments
Comment #1
Jose Reyero CreditAttribution: Jose Reyero commented> When there are no realm keys in a realm
When does this happen?
Comment #2
Jose Reyero CreditAttribution: Jose Reyero commentedComment #3
james.williams CreditAttribution: james.williams commentedThis can happen when defining your own realm, or using a realm that may not have any potential values yet. In my case, I was setting up a realm for each entity of a custom entity type (i.e. the same as a realm for each node of a certain type, or similar to a realm for each available organic group). If no entities of that type have been created, or all are unpublished, then there would be no available realm keys (in which case, no variables are overridden as no value for this realm is ever made 'current').
The variable realm system ought to be able to handle this scenario, as it is designed for other modules to implement realms. Otherwise, it needs to be clearly documented somewhere that all realms MUST have available 'options'.
Comment #4
Jose Reyero CreditAttribution: Jose Reyero commentedOk, committed, hope it helps your experiments and we see some module soon :-)