Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change block to work with latest changes
  • Loading branch information
SantosGuillamot committed Aug 29, 2022
commit cd42bff9b033c8df2d8363570662d98ebe9273a8
8 changes: 1 addition & 7 deletions src/blocks/dynamic-interactive-child/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
"public": true,
"source": "text",
"selector": ".dynamic-child-block-date"
},
"state": {
"type": "object",
"public": true,
"source": "attribute",
"attribute": "state"
}
},
"supports": {
Expand All @@ -39,5 +33,5 @@
"editorScript": "file:./index.js",
"editorStyle": "file:./style.css",
"style": "file:./style-index.css",
"viewScript": "file:./frontend.js"
"viewScript": "file:./register-view.js"
}
4 changes: 0 additions & 4 deletions src/blocks/dynamic-interactive-child/frontend.js

This file was deleted.

3 changes: 1 addition & 2 deletions src/blocks/dynamic-interactive-child/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ function render_block_dynamic_interactive_child_bhe($attributes, $content, $bloc

$post = get_post();
$date = $post->post_date;
$state = array('prop' => 'hola');
$wrapper_attributes = get_block_wrapper_attributes(array('class' => $align_class_name, 'state' => json_encode($state)));
$wrapper_attributes = get_block_wrapper_attributes(array('class' => $align_class_name, 'statePatata' => $state));

return sprintf(
'<div %1$s>
Expand Down
4 changes: 4 additions & 0 deletions src/blocks/dynamic-interactive-child/register-view.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import registerBlockView from '../../gutenberg-packages/register-block-view';
import View from './view';

registerBlockView('bhe/dynamic-interactive-child', View);
3 changes: 1 addition & 2 deletions src/blocks/dynamic-interactive-child/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const View = ({ blockProps, attributes }) => {

return (
<div {...blockProps}>
<p>Pooooost Date: {attributes.date}</p>
<p>State: {attributes.state}</p>
<p>Post Date: {attributes.date}</p>
<p>Counter: {counter}</p>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion src/blocks/dynamic-non-interactive-parent/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
},
"textdomain": "bhe",
"editorScript": "file:./index.js",
"style": "file:./style-index.css"
"style": "file:./style-index.css",
"viewScript": "file:./register-view.js"
}