Can a behavior's tag processing code access the filter ID?

Is there a clean way for a behavior, within some code implementing a
particular tag for that behavior, to access the ID of the text filter
which is in effect during the moment when the tag is processed?

At the moment, I’m overriding the private parse_object method, storing
object.filter_id in an instance variable and checking this inside the
tag processing code. That’s pretty nasty. Since parse_object is a
private method it has every right to change signature, operation or even
vanish in a future version of Radiant so the code I’m currently using is
asking for trouble!

FWIW the real answer is that my behavior shouldn’t be returning HTML
from a tag expansion in the first place, so it shouldn’t need to know;
but I’m still curious about whether or not there’s a better way to do
this.

Andrew H. wrote:

Is there a clean way for a behavior, within some code implementing a
particular tag for that behavior, to access the ID of the text filter
which is in effect during the moment when the tag is processed?

Probably not.

At the moment, I’m overriding the private parse_object method, storing
object.filter_id in an instance variable and checking this inside the
tag processing code. That’s pretty nasty. Since parse_object is a
private method it has every right to change signature, operation or even
vanish in a future version of Radiant so the code I’m currently using is
asking for trouble!

That’s probably the best way for now. If you’d like to suggest an
alternative with a patch I’d consider applying it.


John L.
http://wiseheartdesign.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs