rafactoring enqueue php functions

This commit is contained in:
Antoine M 2023-10-27 17:44:07 +02:00
parent 82c6e785ea
commit 2b6cff645c

View File

@ -10,7 +10,7 @@
/* --------------------------- /* ---------------------------
BLOCK CATEGORY BLOCK CATEGORY
---------------------------*/ ---------------------------*/
function wpblock_add_block_categories($categories) function homegrade_add_block_categories($categories)
{ {
return array_merge( return array_merge(
@ -25,7 +25,7 @@ function wpblock_add_block_categories($categories)
$categories $categories
); );
} }
add_action('block_categories', 'wpblock_add_block_categories', 25, 2); add_action('block_categories_all', 'homegrade_add_block_categories', 25, 2);
@ -144,7 +144,6 @@ function homegrade_allowed_block_types($allowed_blocks, $editor_context)
); );
} }
add_filter('homegrade_allowed_block_types', 'misha_allowed_block_types', 25, 2);
if ('fiche-questions' === $editor_context->post->post_type) { if ('fiche-questions' === $editor_context->post->post_type) {
$allowed_blocks = array( $allowed_blocks = array(
@ -172,11 +171,15 @@ function homegrade_allowed_block_types($allowed_blocks, $editor_context)
// return array_keys($blocks); // return array_keys($blocks);
} }
// add_filter('homegrade_allowed_block_types', 'homegrade_allowed_block_types', 25, 2);
function wpdocs_allowed_block_types($block_editor_context, $editor_context) function homegrade_allowed_block_types_all($block_editor_context, $editor_context)
{ {
if ('conseils' === $editor_context->post->post_type) {
// write_log($editor_context);
}
if (!empty($editor_context->post)) { if (!empty($editor_context->post)) {
return array( return array(
'core/paragraph', 'core/paragraph',
@ -188,7 +191,7 @@ function wpdocs_allowed_block_types($block_editor_context, $editor_context)
return $block_editor_context; return $block_editor_context;
} }
// add_filter('allowed_block_types_all', 'wpdocs_allowed_block_types', 10, 2); // add_filter('allowed_block_types_all', 'homegrade_allowed_block_types_all', 10, 2);
/* ------------------------------------- /* -------------------------------------
POST TYPE TEMPLATES POST TYPE TEMPLATES
-------------------------------------*/ -------------------------------------*/