Hey guys, I'm writing some custom tags and I'm a little confused by
something. I think I've figured out how to call terminal single tags from
within other tags, but how do I do this with a double tag that potentially
has stuff inside it that needs to be rendered? Should I call render_snippet
on the whole thing or can I somehow call tag.render but expand the content
between the outer tags?

For example, I have an input tag:

<r:my_extension:input object="site_user" field="name" type="text">
 <span class="error"><r:error/></span>
</r:my_extension:input>

I want to create another tag that generates a whole login form, which
includes multiple instances of this input tag. But I'm not sure how to do
it.

<r:my_extension:login_form />

So far, I have:

tag 'my_extension:login_form' do |tag|
  if tag.double?
    content = tag.expand
  else
    tag_options = {
      'object' => 'site_user',
      'field' => 'name',
      'type' => 'text'
    }
    content = %{<p>#{tag.render('input', tag_options)</p>...} # how do I
call tag.render
                                                              # but also put
stuff inbetween
                                                              # the opening
and closing tags?
  end
  content
end

Thanks in advance for your help!

Carl

Reply via email to