some test for modifyng block name on the fly
This commit is contained in:
parent
224b0891b1
commit
554c2d1b1b
|
|
@ -1,7 +1,28 @@
|
||||||
export default function editorInit() {
|
export default function editorInit() {
|
||||||
categoriesInit();
|
categoriesInit();
|
||||||
|
updateBlockCategory();
|
||||||
|
console.log(`updateBlockCategory`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateBlockCategory() {
|
||||||
|
wp.hooks.addFilter(
|
||||||
|
'blocks.registerBlockType',
|
||||||
|
'homegrade-content-blocks/vocabulaire-summary',
|
||||||
|
(settings, name) => {
|
||||||
|
if (
|
||||||
|
name ===
|
||||||
|
'homegrade-content-blocks/vocabulaire-summary'
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
...settings,
|
||||||
|
title: 'Nouveau Titre du Bloc',
|
||||||
|
category: 'metiers-patrimoine-blocks', // Nouvelle catégorie souhaitée
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
function categoriesInit() {
|
function categoriesInit() {
|
||||||
wp.blocks.updateCategory('metiers-patrimoine-blocks', {
|
wp.blocks.updateCategory('metiers-patrimoine-blocks', {
|
||||||
icon: (
|
icon: (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user