FEATURE Handling custom anchors and changing block icon
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b813223fcd
commit
7b27f68053
|
|
@ -5,15 +5,22 @@
|
|||
"version": "0.1.0",
|
||||
"title": "Archives des notices biographiques",
|
||||
"category": "carhop-blocks",
|
||||
"icon": "smiley",
|
||||
"icon": "grid-view",
|
||||
"description": "Archives des notices biographiques",
|
||||
"supports": {
|
||||
"html": false
|
||||
"html": false,
|
||||
"anchor": true
|
||||
},
|
||||
"textdomain": "carhop-blocks",
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"style": "file:./style-index.css",
|
||||
"render": "file:./render.php",
|
||||
"viewScript": "file:./view.js"
|
||||
"viewScript": "file:./view.js",
|
||||
"attributes": {
|
||||
"anchor": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
import { registerBlockType } from "@wordpress/blocks";
|
||||
import "./style.scss";
|
||||
import Edit from "./edit";
|
||||
import save from "./save";
|
||||
import metadata from "./block.json";
|
||||
registerBlockType(metadata.name, {
|
||||
edit: Edit,
|
||||
save,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
$initialPostDisplayAmount = 10;
|
||||
|
||||
$anchor = $attributes['anchor'] ?? false;
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'dbmob',
|
||||
'posts_per_page' => $initialPostDisplayAmount,
|
||||
|
|
@ -9,7 +11,7 @@ $args = array(
|
|||
$query = new WP_Query($args);
|
||||
$post_count = $query->found_posts;
|
||||
?>
|
||||
<section <?php echo get_block_wrapper_attributes(array('class' => '')); ?>>
|
||||
<section <?php echo get_block_wrapper_attributes(array('class' => '', 'id' => $anchor)); ?>>
|
||||
<h2>Les notices rédigées par le CARHOP</h2>
|
||||
|
||||
<div class="notices-toolbar" data-post-type="dbmob">
|
||||
|
|
|
|||
10
plugins/carhop-blocks/src/dbmob-archives/save.js
Normal file
10
plugins/carhop-blocks/src/dbmob-archives/save.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { useBlockProps, RichText, InnerBlocks } from "@wordpress/block-editor";
|
||||
import { __ } from "@wordpress/i18n";
|
||||
|
||||
export default function save({ attributes, setAttributes }) {
|
||||
return (
|
||||
<>
|
||||
<InnerBlocks.Content />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user