File: /home/alfouzantranspor/www/wp-content/themes/transportation-agency-pro/includes/block-patterns.php
<?php
/**
* Transportation Agency Pro : Block Patterns
*
* @since Transportation Agency Pro 1.0
*/
function transportation_agency_problock_register_block_patterns() {
$block_pattern_categories = array(
'transportation-agency-pro' => array( 'label' => __( 'Transportation Agency Pro', 'transportation-agency-pro' ) ),
);
/**
* Filters the theme block pattern categories.
*
* @since Transportation Agency Pro 1.0
*
*/
$block_pattern_categories = apply_filters( 'transportation_agency_problock_block_pattern_categories', $block_pattern_categories );
foreach ( $block_pattern_categories as $name => $properties ) {
if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( $name ) ) {
register_block_pattern_category( $name, $properties ); // phpcs:ignore WPThemeReview.PluginTerritory.ForbiddenFunctions.editor_blocks_register_block_pattern_category
}
}
$theme_validation_status = ThemeWhizzie::get_the_validation_status();
if($theme_validation_status == 'true'){
$block_patterns = array(
'transportation-agency-pro-background-header',
'transportation-agency-pro-block-slider',
'transportation-agency-pro-block-search-form',
'transportation-agency-pro-block-service',
'transportation-agency-pro-block-gallery',
'transportation-agency-pro-about-us',
'transportation-agency-pro-block-our-place',
'transportation-agency-pro-testimonial',
'transportation-agency-pro-block-pricing',
'transportation-agency-pro-blog',
'transportation-agency-pro-block-with-post-title',
'transportation-agency-pro-block-header',
'transportation-agency-pro-block-with-heading-title',
'transportation-agency-pro-block-with-archive-title',
'transportation-agency-pro-block-footer',
);
}else {
$block_patterns = array(
'transportation-agency-pro-background-header',
'transportation-agency-pro-block-footer',
'transportation-agency-pro-block-slider',
'license-false',
'transportation-agency-pro-block-header',
);
}
/**
* Filters the theme block patterns.
*
* @since Transportation Agency Pro 1.0
*
* @param array $block_patterns List of block patterns by name.
*
*/
$block_patterns = apply_filters( 'transportation_agency_pro_block_patterns', $block_patterns );
foreach ( $block_patterns as $block_pattern ) {
$pattern_file = get_theme_file_path( '/includes/patterns/' . $block_pattern . '.php' );
register_block_pattern( // phpcs:ignore WPThemeReview.PluginTerritory.ForbiddenFunctions.editor_blocks_register_block_pattern
'transportation-agency-pro/' . $block_pattern,
require $pattern_file // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
);
}
}
add_action( 'init', 'transportation_agency_problock_register_block_patterns', 9 );