File: /var/www/html/insiders/wp-load/wp-content/plugins/breadly/block-library/blocks.php
<?php
require GTM_BLOCKS_DIR . 'about-author.php';
require GTM_BLOCKS_DIR . 'author-socials.php';
require GTM_BLOCKS_DIR . 'amp-code.php';
require GTM_BLOCKS_DIR . 'asd.php';
require GTM_BLOCKS_DIR . 'box.php';
require GTM_BLOCKS_DIR . 'breadcrumbs.php';
require GTM_BLOCKS_DIR . 'content-area.php';
require GTM_BLOCKS_DIR . 'content-area-column.php';
require GTM_BLOCKS_DIR . 'custom-field.php';
require GTM_BLOCKS_DIR . 'decorated-list.php';
require GTM_BLOCKS_DIR . 'directions.php';
require GTM_BLOCKS_DIR . 'direction.php';
require GTM_BLOCKS_DIR . 'editor-note.php';
require GTM_BLOCKS_DIR . 'headline.php';
require GTM_BLOCKS_DIR . 'floating-box.php';
require GTM_BLOCKS_DIR . 'grid.php';
require GTM_BLOCKS_DIR . 'grid-tile.php';
require GTM_BLOCKS_DIR . 'icon.php';
require GTM_BLOCKS_DIR . 'icon-link.php';
require GTM_BLOCKS_DIR . 'icon-links.php';
require GTM_BLOCKS_DIR . 'ingredient.php';
require GTM_BLOCKS_DIR . 'mega-menu.php';
require GTM_BLOCKS_DIR . 'mega-menu-link.php';
require GTM_BLOCKS_DIR . 'nutrition.php';
require GTM_BLOCKS_DIR . 'nutrition-template.php';
require GTM_BLOCKS_DIR . 'nutrients.php';
require GTM_BLOCKS_DIR . 'popup-box.php';
require GTM_BLOCKS_DIR . 'post-author.php';
require GTM_BLOCKS_DIR . 'post-author-date.php';
require GTM_BLOCKS_DIR . 'post-comment-count.php';
require GTM_BLOCKS_DIR . 'post-counter.php';
require GTM_BLOCKS_DIR . 'post-date.php';
require GTM_BLOCKS_DIR . 'post-date-box.php';
require GTM_BLOCKS_DIR . 'post-excerpt.php';
require GTM_BLOCKS_DIR . 'post-featured-image-caption.php';
require GTM_BLOCKS_DIR . 'post-featured-image.php';
require GTM_BLOCKS_DIR . 'post-featured-image-text.php';
require GTM_BLOCKS_DIR . 'post-format-icon.php';
require GTM_BLOCKS_DIR . 'post-navigation-link.php';
require GTM_BLOCKS_DIR . 'post-read-more.php';
require GTM_BLOCKS_DIR . 'post-read-time.php';
require GTM_BLOCKS_DIR . 'post-review.php';
require GTM_BLOCKS_DIR . 'post-share.php';
require GTM_BLOCKS_DIR . 'post-template.php';
require GTM_BLOCKS_DIR . 'post-terms.php';
require GTM_BLOCKS_DIR . 'post-title.php';
require GTM_BLOCKS_DIR . 'post-views.php';
require GTM_BLOCKS_DIR . 'query-result.php';
require GTM_BLOCKS_DIR . 'recipe.php';
require GTM_BLOCKS_DIR . 'recipe-template.php';
require GTM_BLOCKS_DIR . 'review-breakdown.php';
require GTM_BLOCKS_DIR . 'review-note.php';
require GTM_BLOCKS_DIR . 'review-total-score.php';
require GTM_BLOCKS_DIR . 'review-template.php';
require GTM_BLOCKS_DIR . 'review.php';
require GTM_BLOCKS_DIR . 'section-headline.php';
require GTM_BLOCKS_DIR . 'separator.php';
require GTM_BLOCKS_DIR . 'slider-template.php';
require GTM_BLOCKS_DIR . 'sliding-panel.php';
require GTM_BLOCKS_DIR . 'spacer.php';
require GTM_BLOCKS_DIR . 'tabs.php';
require GTM_BLOCKS_DIR . 'tab.php';
require GTM_BLOCKS_DIR . 'template-summary.php';
require GTM_BLOCKS_DIR . 'template-title.php';
require GTM_BLOCKS_DIR . 'terms.php';
/**
* Manage assets
*/
add_action( 'init', 'gtm_setup_block_assets', 20 );
function gtm_setup_block_assets() {
// Shared assets
wp_register_script( 'gtm-block-shared', GTM_URL . 'build/shared.js', [
'lodash',
'react',
'react-dom',
], GTM_VERSION, true
);
wp_register_style( 'gtm-block-shared-style', GTM_URL . 'build/shared-style.css', [], GTM_VERSION );
wp_style_add_data( "gtm-block-shared-style", 'rtl', 'replace' );
wp_register_style( 'gtm-block-shared-editor-style', GTM_URL . 'build/shared-editor-style.css', [], GTM_VERSION );
wp_style_add_data( "gtm-block-shared-editor-style", 'rtl', 'replace' );
// Block assets
wp_register_script( 'gtm-block-editor-script', GTM_URL . 'build/block.js', [
'react', 'react-dom', 'wp-blocks', 'wp-polyfill', 'wp-url', 'wp-edit-post',
'gtm-block-shared',
], GTM_VERSION, true
);
wp_register_script( 'gtm-block-script', GTM_URL . 'build/script.js', [], GTM_VERSION, true );
wp_localize_script( 'gtm-block-editor-script', 'gtm_config', apply_filters( 'gtm_config', [
'image_sizes' => wp_get_registered_image_subsizes(),
'image_size_options' => function_exists( 'gtm_get_image_size_options' ) ? gtm_get_image_size_options() : [],
'sidebars' => function_exists( 'gtm_get_sidebar_choices' ) ? gtm_get_sidebar_choices() : [],
'is_post_views_active' => GTM_POST_VIEWS_IS_ACTIVE,
'icons' => gtm_get_default_icons(),
'gutenberg_version' => gtm_get_gutenberg_version(),
] ) );
wp_register_style( 'fontawesome-base', GTM_URL . 'assets/fontawesome/css/fontawesome.css', [], GTM_VERSION );
wp_register_style( 'fontawesome-brands', GTM_URL . 'assets/fontawesome/css/brands.css', ['fontawesome-base'], GTM_VERSION );
wp_register_style( 'fontawesome-regular', GTM_URL . 'assets/fontawesome/css/regular.css', ['fontawesome-base'], GTM_VERSION );
wp_register_style( 'fontawesome-solid', GTM_URL . 'assets/fontawesome/css/solid.css', ['fontawesome-base'], GTM_VERSION );
wp_register_style( 'eva-icons', GTM_URL . 'assets/eva-icons/eva-icons.css', [], GTM_VERSION );
wp_register_style( 'feather-icons', GTM_URL . 'assets/feather-icons/feather-icons.css', [], GTM_VERSION );
wp_register_style( 'iconic-icons', GTM_URL . 'assets/iconic-icons/iconic-icons.css', [], GTM_VERSION );
wp_register_style( 'gtm-basic-icons', GTM_URL . 'assets/basic-icons/gtm-basic-icon.css', [], GTM_VERSION );
wp_register_style( 'gtm-block-style', GTM_URL . 'build/block-style.css', array_merge( ['gutenmate-plugin', 'gtm-block-shared-style'], gtm_get_icon_set_enqueue_handles() ), GTM_VERSION );
wp_style_add_data( "gtm-block-style", 'rtl', 'replace' );
wp_register_style( 'gtm-block-editor-style', GTM_URL . 'build/block-editor-style.css', ['wp-edit-blocks', 'gtm-block-shared-editor-style'], GTM_VERSION );
wp_style_add_data( "gtm-block-editor-style", 'rtl', 'replace' );
// Style from preset panel
wp_register_style( 'gtm-preset-style', GTM_URL . 'assets/css/dummy-with-preview-support.css', [], GTM_VERSION );
// Style from plugin settings
wp_register_style( 'gtm-global-style', GTM_URL . 'assets/css/dummy-with-preview-support.css', [], GTM_VERSION );
// Core block extension styles
$core_blocks = [
'core-avatar',
'core-comment-template',
'core-navigation',
'core-post-excerpt',
'core-gallery',
'core-query-pagination-next',
'core-query-pagination-numbers',
'core-query-pagination-previous',
'core-query',
'core-quote',
'core-search',
'core-site-logo',
];
foreach ( $core_blocks as $block_name ) {
$args = [
'handle' => "gtm-$block_name",
'src' => GTM_URL . "build/extensions/$block_name-style.css",
];
// WORKAROUND: wp_enqueue_block_style() does not support wp_style_add_data() for adding RTL style
// We need to register it before calling wp_enqueue_block_style()
wp_register_style( $args['handle'], $args['src'] );
// Enqueue style for the block
wp_enqueue_block_style( str_replace( 'core-', 'core/', $block_name ), $args );
// WORKAROUND: Keep adding RTL after calling wp_enqueue_block_style()
// Hope the function can support adding RTL style in the future
wp_style_add_data( $args['handle'], 'rtl', 'replace' );
}
}
add_action( 'enqueue_block_editor_assets', 'gtm_enqueue_block_editor_assets' );
function gtm_enqueue_block_editor_assets() {
// Workaround since FSE can't handle dynamic inline style
// https://github.com/WordPress/gutenberg/issues/18571
wp_enqueue_style( 'gtm-preset-style' );
wp_enqueue_style( 'gtm-global-style' );
// Force enqueue editorstyle, since editorStyle in block.json is also expose editorStyle in front-end
wp_enqueue_style( 'gtm-block-editor-style' );
}
add_action( 'enqueue_block_assets', 'gtm_enqueue_block_assets' );
function gtm_enqueue_block_assets() {
wp_enqueue_style( 'gtm-block-style' );
wp_enqueue_style( 'gtm-preset-style' );
wp_enqueue_style( 'gtm-global-style' );
}
/**
* Add block categories
*/
add_filter( 'block_categories_all', 'gtm_add_block_categories', 10, 2 );
function gtm_add_block_categories( $categories, $editor_context ) {
$add_cats = [
[
'slug' => 'gtm-blocks',
'title' => esc_html__( 'Gutenmate', 'gutenmate' ),
'icon' => null,
],
[
'slug' => 'gtm-layout',
'title' => esc_html__( 'Gutenmate - Layout', 'gutenmate' ),
'icon' => null,
],
[
'slug' => 'gtm-posts',
'title' => esc_html__( 'Gutenmate - Posts', 'gutenmate' ),
'icon' => null,
],
[
'slug' => 'gtm-loop',
'title' => esc_html__( 'Gutenmate - Query Loop', 'gutenmate' ),
'icon' => null,
],
[
'slug' => 'gtm-review',
'title' => esc_html__( 'Gutenmate - Review', 'gutenmate' ),
'icon' => null,
],
[
'slug' => 'gtm-recipe',
'title' => esc_html__( 'Gutenmate - Recipe', 'gutenmate' ),
'icon' => null,
],
[
'slug' => 'gtm-mega-menu',
'title' => esc_html__( 'Gutenmate - Mega Menu', 'gutenmate' ),
'icon' => null,
],
[
'slug' => 'gtm-asd',
'title' => esc_html__( 'Gutenmate - Ads', 'gutenmate' ),
'icon' => null,
],
];
array_splice( $categories, 0, 0, $add_cats );
return $categories;
}
/**
* Add REST field for comment count
* For using in query loop block
*/
add_action( 'rest_api_init', 'gtm_register_rest_field_comment_count' );
function gtm_register_rest_field_comment_count() {
register_rest_field( 'post', 'gtm_comment_count', [
'get_callback' => function ( $post ) {
return (int) wp_count_comments( $post['id'] )->approved;
},
'schema' => [
'description' => 'List number of comments attached to this post.',
'type' => 'integer',
],
] );
}
/**
* Add template areas
*/
add_filter( 'default_wp_template_part_areas', 'gtm_add_template_part_areas', 11 );
function gtm_add_template_part_areas( $areas ) {
$current_areas = [];
foreach ( $areas as $area ) {
$current_areas[] = $area['area'];
}
if ( ! in_array( 'gtm-area-review', $current_areas ) ) {
$areas[] = [
'area' => 'gtm-area-review',
'icon' => 'symbolFilled',
'label' => esc_html__( 'Review', 'gutenmate' ),
'description' => esc_html__(
'The template defines a review area.'
, 'gutenmate'
),
'area_tag' => 'div',
];
}
if ( ! in_array( 'gtm-area-recipe', $current_areas ) ) {
$areas[] = [
'area' => 'gtm-area-recipe',
'icon' => 'symbolFilled',
'label' => esc_html__( 'Recipe', 'gutenmate' ),
'description' => esc_html__(
'The template defines an recipe area.'
, 'gutenmate'
),
'area_tag' => 'div',
];
}
if ( ! in_array( 'gtm-area-nutrition', $current_areas ) ) {
$areas[] = [
'area' => 'gtm-area-nutrition',
'icon' => 'symbolFilled',
'label' => esc_html__( 'Nutrition', 'gutenmate' ),
'description' => esc_html__(
'The template defines an nutrition area.'
, 'gutenmate'
),
'area_tag' => 'div',
];
}
return $areas;
}