Changeset 56578 for trunk/src/wp-includes/block-template-utils.php
- Timestamp:
- 09/14/2023 08:50:43 AM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-template-utils.php
r56414 r56578 515 515 516 516 /** 517 * Injects the active theme's stylesheet as a `theme` attribute 518 * into a given template part block. 519 * 520 * @since 6.4.0 521 * @access private 522 * 523 * @param array $block a parsed block. 524 * @return array Updated block. 525 */ 526 function _inject_theme_attribute_in_template_part_block( $block ) { 527 if ( 528 'core/template-part' === $block['blockName'] && 529 ! isset( $block['attrs']['theme'] ) 530 ) { 531 $block['attrs']['theme'] = get_stylesheet(); 532 } 533 return $block; 534 } 535 536 /** 517 537 * Parses a block template and removes the theme attribute from each template part. 518 538 * … … 566 586 $template->id = $theme . '//' . $template_file['slug']; 567 587 $template->theme = $theme; 568 $template->content = _inject_theme_attribute_in_block_template_content( $template_content );569 588 $template->slug = $template_file['slug']; 570 589 $template->source = 'theme'; … … 589 608 $template->area = $template_file['area']; 590 609 } 610 611 $blocks = parse_blocks( $template_content ); 612 $template->content = serialize_blocks( $blocks, '_inject_theme_attribute_in_template_part_block' ); 591 613 592 614 return $template;
Note: See TracChangeset
for help on using the changeset viewer.