Skip to content

Commit

Permalink
Add template_type guards (#36318)
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham authored and noisysocks committed Nov 11, 2021
1 parent 7e0e9af commit 5a45613
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/compat/wordpress-5.9/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ function _get_block_templates_paths( $base_directory ) {
* @return array|null Template.
*/
function _get_block_template_file( $template_type, $slug ) {
if ( 'wp_template' !== $template_type && 'wp_template_part' !== $template_type ) {
return null;
}

$template_base_paths = array(
'wp_template' => 'block-templates',
'wp_template_part' => 'block-template-parts',
Expand Down Expand Up @@ -264,6 +268,10 @@ function _get_block_template_file( $template_type, $slug ) {
* @return array Template.
*/
function _get_block_templates_files( $template_type ) {
if ( 'wp_template' !== $template_type && 'wp_template_part' !== $template_type ) {
return null;
}

$template_base_paths = array(
'wp_template' => 'block-templates',
'wp_template_part' => 'block-template-parts',
Expand Down

0 comments on commit 5a45613

Please sign in to comment.