Method: ScrivitoHelper#scrivito_tag
- Defined in:
- app/helpers/scrivito_helper.rb
#scrivito_tag(tag_name, obj_or_widget, field_name, html_options = {}, editing_options = {}, &block) ⇒ String
Note:
If the param field_name is of type widget, then tag_name must be a block tag, like div or h1. An inline tag like p or span could result in broken HTML output, since the widgets are rendered within block tags.
Renders a field within the given HTML tag.
This method also renders additional attributes, which are needed for in-place editing. These attributes are only rendered when appropriate, i.e. not for a regular visitor.
The helper is similar to (and internally uses) api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag. You can add additional HTML attributes by passing them in html_options.
73 74 75 76 77 78 79 |
# File 'app/helpers/scrivito_helper.rb', line 73 def scrivito_tag(tag_name, , field_name, = {}, = {}, &block) Scrivito::CmsFieldTag.new(self, tag_name, , .merge( widget_render_context: , field_name: field_name.to_s )).render(, &block) end |