Make WordPress Core

Changeset 57594

Timestamp:
02/12/2024 01:13:38 PM (6 months ago)
Author:
Bernhard Reiter
Message:

Block Hooks: Inject hooked blocks into modified templates and parts.

Using the new technique introduced in [57157] of using a metadata.ignoredHookedBlocks attribute in the anchor block to store information about whether or not a hooked block should be considered for injection, extend said injection to encompass modified templates and parts.

Fixes #59646.
Props gziolo, matveb.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-template-utils.php

    r57349 r57594  
    902902    }
    903903
     904
     905
     906
     907
     908
     909
     910
     911
    904912    return $template;
    905913}
  • trunk/tests/phpunit/tests/block-templates/base.php

    r54269 r57594  
    4040                'post_name'    => 'my_template',
    4141                'post_title'   => 'My Template',
    42                 'post_content' => 'Content',
     42                'post_content' => '',
    4343                'post_excerpt' => 'Description of my template',
    4444                'tax_input'    => array(
     
    5858                'post_name'    => 'my_template_part',
    5959                'post_title'   => 'My Template Part',
    60                 'post_content' => 'Content',
     60                'post_content' => '',
    6161                'post_excerpt' => 'Description of my template part',
    6262                'tax_input'    => array(
  • trunk/tests/phpunit/tests/block-templates/buildBlockTemplateResultFromPost.php

    r56983 r57594  
    88 */
    99class Tests_Block_Templates_BuildBlockTemplateResultFromPost extends WP_Block_Templates_UnitTestCase {
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
    1025
    1126    /**
     
    5065        $this->assertSame( self::$template_part_post->post_modified, $template_part->modified, 'Template part result properties match' );
    5166    }
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
    52109}
Note: See TracChangeset for help on using the changeset viewer.