{"id":11206541,"date":"2019-02-14T15:57:26","date_gmt":"2019-02-14T15:57:26","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/nested-blocks-custom-html\/"},"modified":"2019-02-14T16:12:15","modified_gmt":"2019-02-14T16:12:15","slug":"nested-blocks-custom-html","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/nested-blocks-custom-html\/","title":{"rendered":"Nested blocks \/ custom HTML"},"content":{"rendered":"<p>Some of the core Gutenberg blocks allow nesting other blocks within them, like <code>layout<\/code><\/p>\n<p>Would it be possible to do this in <strong>Block Lab<\/strong> maybe by having a &#8216;Custom HTML&#8217; field type that functions like the core Gutenberg one?<\/p>\n<p>Ultimately if one could add custom blocks they&#8217;ve made or core Gutenberg ones, within others blocks they&#8217;re making that would open up a whole bunch of possibilities.<\/p>\n<p>For e.g. I&#8217;ve made a slightly enhanced accordion block with a badge in the heading. The template file&#8217;s contents look like this, look at the comment in the accordion text:<\/p>\n<pre><code>&lt;div class=&quot;panel panel-default&quot;&gt;\n \n    &lt;h5 class=&quot;panel-heading&quot;&gt;\n        &lt;a class=&quot;&quot; role=&quot;button&quot; data-toggle=&quot;collapse&quot; href=&quot;#&lt;?php block_field( &#039;id&#039; ); ?&gt;&quot; aria-expanded=&quot;true&quot; aria-controls=&quot;collapse-3&quot;&gt;\n            &lt;?php block_field( &#039;title&#039; ); ?&gt; \n            &lt;span class=&quot;badge pull-right&quot;&gt;&lt;?php block_field( &#039;badge&#039; ); ?&gt;&lt;\/span&gt;\n        &lt;\/a&gt;\n    &lt;\/h5&gt;\n\n      &lt;div id=&quot;&lt;?php block_field( &#039;id&#039; ); ?&gt;&quot; class=&quot;collapse in&quot; aria-expanded=&quot;true&quot; style=&quot;&quot;&gt;\n        &lt;p class=&quot;panel-body&quot;&gt;\n        &lt;?php block_field( &#039;content-text&#039; ); ?&gt; \n        &lt;!-- this is a textarea field type --&gt;\n        &lt;!-- In editing mode could we click into it and have a &#039;+&#039; to add another custom block like gutenberg does? --&gt;\n        &lt;\/p&gt;\n      &lt;\/div&gt;\n\n&lt;\/div&gt;<\/code><\/pre>\n<p>In your recent blog post you&#8217;ve achieved something similar with gravity forms by using <\/p>\n<p><code>gravity_form( $form_id , false, false, false, &#039;&#039;, true, 12 );<\/code><\/p>\n<p>in the template and referencing the form ID, this was possible because gravity form allows embedding by calling a PHP function and also it feels kind of hardcoding one instance of the form block into our custom block. <\/p>\n<p>Would it be possible to have a field type that allows this in <strong>Block Lab<\/strong>?<\/p>\n","protected":false},"template":"","class_list":["post-11206541","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11206541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":3,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11206541\/revisions"}],"predecessor-version":[{"id":11206605,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11206541\/revisions\/11206605"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11206541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}