Ah, interesting thought about passing markup! We do actually do that occassionally. for 'container'-like components:
{# Add all tabs to a tabs bar ... #} {{ render_component('ui.tabs', { items: [ 'general' ] }) }} {# Render the tab contents ... #} {{ render_component('ui.tab', { id: 'general', content: include('@Sales/partial/general.html.twig', { 'order': salesOrder }) }) }} {# Render more tabs ... #}
with the Tab-component implementation looking like this:
{% component tab { id: { type: 'string', comment: 'Tab id (match with tabs)', preview: 'tab_one' }, content: { type: 'string', comment: 'Your tab contents' } } with options %} <div class="ui tab" data-tab="{{ tab.id }}"> {{ tab.content|raw }} </div>
Although that of course uses Includes instead of Embeds...
You could, for instance, include a render_component() or block() function call inside a component, like this:
render_component()
block()
{{ render_component('ui.tab', { id: datatable.name, content: render_component('ui.datatable', { data_table: datatable }) }) }}
Is this sort of what you were thinking of? Do you have any suggestions for further fleshing out? Would love to see our approach find some traction 😉
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ah, interesting thought about passing markup! We do actually do that occassionally. for 'container'-like components:
with the Tab-component implementation looking like this:
Although that of course uses Includes instead of Embeds...
You could, for instance, include a
render_component()orblock()function call inside a component, like this:Is this sort of what you were thinking of? Do you have any suggestions for further fleshing out? Would love to see our approach find some traction 😉