If for some reason a condition plugin is no longer registering, and that condition has been used, an error is returned anywhere the condition is viewed/edited. I think it would be best to replicate how this is handled in views, where a Broken handler will essentially take place of the missing plugin. In our case, this would be a BrokenCondition
which would automatically return 'false' when evaluated in javascript.
We will need to decide where would be best to to place the logic for swapping in BrokenCondition
in the place of the missing plugin. I think potentially Drupal\smart_content\Condition\ConditionManager::createInstance()
could have a check to see if the plugin exists, and if it doesn't, then it would return the fallback.
This would reduce the need for checking if the definition exists every time you want to create an instance. The only risk would be if you are calling 'createInstance' with the expectation to get the exact Condition you called, because you are calling condition specific behavior, however this is something we are generally trying to avoid.
Open to other ideas, but this is where my heads at currently.
Comments
Comment #2
gantal CreditAttribution: gantal at Elevated Third commentedTagging for DrupalCamp Colorado's upcoming contrib day.
Comment #4
michaellander CreditAttribution: michaellander at Elevated Third commented