+ );
+};
+
+export default View;
diff --git a/src/blocks/dynamic-interactive-parent/block.json b/src/blocks/dynamic-interactive-parent/block.json
new file mode 100644
index 00000000..3bb66d09
--- /dev/null
+++ b/src/blocks/dynamic-interactive-parent/block.json
@@ -0,0 +1,57 @@
+{
+ "$schema": "https://schemas.wp.org/trunk/block.json",
+ "apiVersion": 2,
+ "name": "bhe/dynamic-interactive-parent",
+ "version": "0.1.0",
+ "title": "BHE - Dynamic Interactive Parent",
+ "category": "text",
+ "icon": "flag",
+ "description": "",
+ "usesContext": [
+ "postId",
+ "postType",
+ "queryId"
+ ],
+ "attributes": {
+ "counter": {
+ "type": "number",
+ "default": 0,
+ "public": true
+ },
+ "blockTitle": {
+ "type": "string",
+ "public": true
+ },
+ "state": {
+ "type": "string",
+ "public": true,
+ "source": "text",
+ "selector": ".dynamic-parent-block-state"
+ },
+ "secret": {
+ "type": "string",
+ "default": "fa4e3d47e4e0a38c5c57533391855013"
+ }
+ },
+ "supports": {
+ "color": {
+ "text": true
+ },
+ "typography": {
+ "fontSize": true,
+ "__experimentalFontWeight": true,
+ "__experimentalLetterSpacing": true
+ },
+ "html": true,
+ "view": true
+ },
+ "providesContext": {
+ "bhe/dynamic-interactive-title": "blockTitle"
+ },
+ "textdomain": "bhe",
+ "editorScript": "file:./index.js",
+ "editorStyle": "file:./style.css",
+ "style": "file:./style-index.css",
+ "viewScript": "file:./register-view.js",
+ "render": "file:./render.php"
+}
\ No newline at end of file
diff --git a/src/blocks/dynamic-interactive-parent/edit.js b/src/blocks/dynamic-interactive-parent/edit.js
new file mode 100644
index 00000000..1991c702
--- /dev/null
+++ b/src/blocks/dynamic-interactive-parent/edit.js
@@ -0,0 +1,47 @@
+// This import is needed to ensure that the `wp.blockEditor` global is available
+// by the time this component gets loaded. The `Title` component consumes the
+// global but cannot import it because it shouldn't be loaded on the frontend of
+// the site.
+import '@wordpress/block-editor';
+import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
+import { useEntityProp } from '@wordpress/core-data';
+
+import Button from './shared/button';
+import Title from './shared/title';
+
+const Edit = ({ attributes, setAttributes, context }) => {
+ const { counter, blockTitle, secret } = attributes;
+ const { postType, postId, queryId } = context;
+
+ const [rawTitle = '', setTitle, fullTitle] = useEntityProp(
+ 'postType',
+ postType,
+ 'title',
+ postId
+ );
+
+ return (
+
+
Post Title: {fullTitle?.rendered}
+ setAttributes({ blockTitle: val })}
+ placeholder="This will be passed through context to child blocks"
+ className="dynamic-interactive-parent-block-title"
+ >
+ {blockTitle}
+
+
+
+
+ This is a secret attribute that should not be serialized:{' '}
+ {secret}
+
+
+
+ )
+};
+
+export default Edit;
\ No newline at end of file
diff --git a/src/blocks/dynamic-interactive-parent/index.js b/src/blocks/dynamic-interactive-parent/index.js
new file mode 100644
index 00000000..9abd860d
--- /dev/null
+++ b/src/blocks/dynamic-interactive-parent/index.js
@@ -0,0 +1,21 @@
+/**
+ * WordPress dependencies
+ */
+import { registerBlockType } from '@wordpress/blocks';
+import Edit from './edit';
+import { RichText, InnerBlocks } from '@wordpress/block-editor';
+import './style.scss';
+
+// Register the block
+registerBlockType('bhe/dynamic-interactive-parent', {
+ edit: Edit,
+ // If I don't add this, the InnerBlocks don't seem to work in dynamic blocks.
+ save: ({ attributes }) => {
+ return (
+ <>
+
+
+ >
+ )
+ }
+});
\ No newline at end of file
diff --git a/src/blocks/dynamic-interactive-parent/register-view.js b/src/blocks/dynamic-interactive-parent/register-view.js
new file mode 100644
index 00000000..10f90d4c
--- /dev/null
+++ b/src/blocks/dynamic-interactive-parent/register-view.js
@@ -0,0 +1,8 @@
+import CounterContext from '../../context/counter';
+import ThemeContext from '../../context/theme';
+import registerBlockView from '../../gutenberg-packages/register-block-view';
+import View from './view';
+
+registerBlockView('bhe/dynamic-interactive-parent', View, {
+ providesContext: [ThemeContext, CounterContext],
+});
diff --git a/src/blocks/dynamic-interactive-parent/render.php b/src/blocks/dynamic-interactive-parent/render.php
new file mode 100644
index 00000000..46c2ca2f
--- /dev/null
+++ b/src/blocks/dynamic-interactive-parent/render.php
@@ -0,0 +1,25 @@
+inner_blocks as $inner_block) {
+ $inner_blocks_html .= $inner_block->render();
+}
+$state = [
+ "title" => $post->post_title
+];
+?>
+
+
+
+
+ );
+};
+
+export default View;
diff --git a/src/blocks/dynamic-non-interactive-parent/block.json b/src/blocks/dynamic-non-interactive-parent/block.json
new file mode 100644
index 00000000..ecd0e21b
--- /dev/null
+++ b/src/blocks/dynamic-non-interactive-parent/block.json
@@ -0,0 +1,32 @@
+{
+ "apiVersion": 2,
+ "title": "BHE - Dynamic Non Interactive Parent",
+ "name": "bhe/dynamic-non-interactive-parent",
+ "category": "text",
+ "icon": "flag",
+ "usesContext": [
+ "postId",
+ "postType",
+ "queryId"
+ ],
+ "attributes": {
+ "blockTitle": {
+ "type": "string",
+ "public": true
+ }
+ },
+ "providesContext": {
+ "bhe/dynamic-non-interactive-title": "blockTitle"
+ },
+ "supports": {
+ "color": {
+ "text": true
+ },
+ "html": true,
+ "view": true
+ },
+ "textdomain": "bhe",
+ "editorScript": "file:./index.js",
+ "style": "file:./style-index.css",
+ "render": "file:./render.php"
+}
\ No newline at end of file
diff --git a/src/blocks/dynamic-non-interactive-parent/edit.js b/src/blocks/dynamic-non-interactive-parent/edit.js
new file mode 100644
index 00000000..8a19f1b9
--- /dev/null
+++ b/src/blocks/dynamic-non-interactive-parent/edit.js
@@ -0,0 +1,38 @@
+// This import is needed to ensure that the `wp.blockEditor` global is available
+// by the time this component gets loaded. The `Title` component consumes the
+// global but cannot import it because it shouldn't be loaded on the frontend of
+// the site.
+import '@wordpress/block-editor';
+import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
+import { useEntityProp } from '@wordpress/core-data';
+import { RichText } from '../../gutenberg-packages/wordpress-blockeditor';
+
+const Edit = ({ attributes, setAttributes, context }) => {
+ const blockProps = useBlockProps();
+ const { postType, postId, queryId } = context;
+
+ const [rawTitle = '', setTitle, fullTitle] = useEntityProp(
+ 'postType',
+ postType,
+ 'title',
+ postId
+ );
+
+ return (
+
+
Post Title: {fullTitle?.rendered}
+ setAttributes({ blockTitle: val })}
+ placeholder="This will be passed through context to child blocks"
+ value={attributes.blockTitle}
+ >
+ {attributes.blockTitle}
+
+
+
+ )
+};
+
+export default Edit;
\ No newline at end of file
diff --git a/src/blocks/dynamic-non-interactive-parent/index.js b/src/blocks/dynamic-non-interactive-parent/index.js
new file mode 100644
index 00000000..c23307a3
--- /dev/null
+++ b/src/blocks/dynamic-non-interactive-parent/index.js
@@ -0,0 +1,21 @@
+/**
+ * WordPress dependencies
+ */
+import { registerBlockType } from '@wordpress/blocks';
+import Edit from './edit';
+import { RichText, InnerBlocks } from '@wordpress/block-editor';
+import './style.scss';
+
+// Register the block
+registerBlockType('bhe/dynamic-non-interactive-parent', {
+ edit: Edit,
+ // If I don't add this, the InnerBlocks don't seem to work in dynamic blocks.
+ save: ({ attributes }) => {
+ return (
+ <>
+
+
+ >
+ )
+ }
+});
\ No newline at end of file
diff --git a/src/blocks/dynamic-non-interactive-parent/render.php b/src/blocks/dynamic-non-interactive-parent/render.php
new file mode 100644
index 00000000..a6133b3a
--- /dev/null
+++ b/src/blocks/dynamic-non-interactive-parent/render.php
@@ -0,0 +1,15 @@
+inner_blocks as $inner_block) {
+ $inner_blocks_html .= $inner_block->render();
+}
+?>
+
+
>
+
Post Title: = $post->post_title ?>
+
Block Title : = $attributes['blockTitle'] ?>
+
+ = $inner_blocks_html ?>
+
+
\ No newline at end of file
diff --git a/src/blocks/dynamic-non-interactive-parent/style.scss b/src/blocks/dynamic-non-interactive-parent/style.scss
new file mode 100644
index 00000000..a5731ff4
--- /dev/null
+++ b/src/blocks/dynamic-non-interactive-parent/style.scss
@@ -0,0 +1,23 @@
+.wp-block-bhe-dynamic-non-interactive-parent {
+ border: 1px solid rgb(0, 86, 129);
+ position: relative;
+ padding: 25px 10px;
+}
+
+.wp-block-bhe-dynamic-non-interactive-parent::before {
+ content: 'BHE - Dynamic Non Interactive Parent';
+ position: absolute;
+ top: 0;
+ right: 0;
+ border: 1px solid rgb(0, 86, 129);
+ background-color: rgb(0, 86, 129);
+ color: white;
+ margin: -1px;
+ padding: 0px 5px;
+ font-size: 10px;
+}
+
+wp-block,
+wp-inner-blocks {
+ display: contents;
+}
\ No newline at end of file