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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jose Reyero’s picture

> When there are no realm keys in a realm
When does this happen?

Jose Reyero’s picture

Status: Needs review » Postponed (maintainer needs more info)
james.williams’s picture

Status: Postponed (maintainer needs more info) » Needs review

This 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'.

Jose Reyero’s picture

Status: Needs review » Fixed

Ok, committed, hope it helps your experiments and we see some module soon :-)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.