Make WordPress Core

Changeset 57569


Ignore:
Timestamp:
02/08/2024 07:30:15 PM (10 months ago)
Author:
SergeyBiryukov
Message:

Twenty Twenty-Two: Prefix the pages block pattern category name.

If a plugin also registers the category name pages in an init hook that runs after the theme's, it can override the label and description unintentionally.

With a prefix, extenders can still override it, but it would be intentional.

Props poena, swissspidy, shailu25.
Fixes #59839.

Location:
trunk/src/wp-content/themes/twentytwentytwo/inc
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentytwo/inc/block-patterns.php

    r52392 r57569  
    1515function twentytwentytwo_register_block_patterns() {
    1616    $block_pattern_categories = array(
    17         'featured' => array( 'label' => __( 'Featured', 'twentytwentytwo' ) ),
    18         'footer'   => array( 'label' => __( 'Footers', 'twentytwentytwo' ) ),
    19         'header'   => array( 'label' => __( 'Headers', 'twentytwentytwo' ) ),
    20         'query'    => array( 'label' => __( 'Query', 'twentytwentytwo' ) ),
    21         'pages'    => array( 'label' => __( 'Pages', 'twentytwentytwo' ) ),
     17        'featured'              => array( 'label' => __( 'Featured', 'twentytwentytwo' ) ),
     18        'footer'                => array( 'label' => __( 'Footers', 'twentytwentytwo' ) ),
     19        'header'                => array( 'label' => __( 'Headers', 'twentytwentytwo' ) ),
     20        'query'                 => array( 'label' => __( 'Query', 'twentytwentytwo' ) ),
     21        'twentytwentytwo_pages' => array( 'label' => __( 'Pages', 'twentytwentytwo' ) ),
    2222    );
    2323
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-about-large-image-and-buttons.php

    r56613 r57569  
    55return array(
    66    'title'      => __( 'About page with large image and buttons', 'twentytwentytwo' ),
    7     'categories' => array( 'pages', 'buttons' ),
     7    'categories' => array( 'twentytwentytwo_pages', 'buttons' ),
    88    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--small, 1.25rem)","bottom":"var(--wp--custom--spacing--small, 1.25rem)"}}},"layout":{"inherit":true}} -->
    99                    <div class="wp-block-group alignfull" style="padding-top:var(--wp--custom--spacing--small, 1.25rem);padding-bottom:var(--wp--custom--spacing--small, 1.25rem)"><!-- wp:image {"align":"wide","width":2100,"height":1260,"sizeSlug":"full","linkDestination":"none"} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-about-links-dark.php

    r52430 r57569  
    55return array(
    66    'title'      => __( 'About page links (dark)', 'twentytwentytwo' ),
    7     'categories' => array( 'pages', 'buttons' ),
     7    'categories' => array( 'twentytwentytwo_pages', 'buttons' ),
    88    'content'    => '<!-- wp:group {"align":"full","style":{"elements":{"link":{"color":{"text":"var:preset|color|background"}}},"spacing":{"padding":{"top":"10rem","bottom":"10rem"}}},"backgroundColor":"primary","textColor":"background","layout":{"inherit":false,"contentSize":"400px"}} -->
    99                    <div class="wp-block-group alignfull has-background-color has-primary-background-color has-text-color has-background has-link-color" style="padding-top:10rem;padding-bottom:10rem;"><!-- wp:group -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-about-links.php

    r52430 r57569  
    55return array(
    66    'title'      => __( 'About page links', 'twentytwentytwo' ),
    7     'categories' => array( 'pages', 'buttons' ),
     7    'categories' => array( 'twentytwentytwo_pages', 'buttons' ),
    88    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"10rem","bottom":"10rem"}}},"layout":{"inherit":false,"contentSize":"400px"}} -->
    99                    <div class="wp-block-group alignfull" style="padding-top:10rem;padding-bottom:10rem;"><!-- wp:image {"align":"center","width":100,"height":100,"sizeSlug":"full","linkDestination":"none","className":"is-style-rounded"} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-about-media-left.php

    r52375 r57569  
    55return array(
    66    'title'      => __( 'About page with media on the left', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:media-text {"align":"full","mediaType":"image","imageFill":true,"focalPoint":{"x":"0.63","y":"0.16"},"backgroundColor":"foreground","className":"alignfull is-image-fill has-background-color has-text-color has-background has-link-color"} -->
    99                    <div class="wp-block-media-text alignfull is-stacked-on-mobile is-image-fill has-background-color has-text-color has-background has-link-color has-foreground-background-color has-background"><figure class="wp-block-media-text__media" style="background-image:url(' . esc_url( get_template_directory_uri() ) . '/assets/images/bird-on-salmon.jpg);background-position:63% 16%"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/bird-on-salmon.jpg" alt="' . esc_attr__( 'Image of a bird on a branch', 'twentytwentytwo' ) . '"/></figure><div class="wp-block-media-text__content"><!-- wp:spacer {"height":32} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-about-media-right.php

    r52375 r57569  
    55return array(
    66    'title'      => __( 'About page with media on the right', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:media-text {"align":"full","mediaPosition":"right","mediaLink":"' . esc_url( get_template_directory_uri() ) . '/assets/images/bird-on-black.jpg","mediaType":"image","style":{"elements":{"link":{"color":{"text":"var:preset|color|background"}}}},"backgroundColor":"foreground","textColor":"background"} -->
    99                <div class="wp-block-media-text alignfull has-media-on-the-right is-stacked-on-mobile has-background-color has-foreground-background-color has-text-color has-background has-link-color"><figure class="wp-block-media-text__media"><img src="' . esc_url( get_template_directory_uri() ) . '/assets/images/bird-on-black.jpg" alt="' . esc_attr__( 'An image of a bird flying', 'twentytwentytwo' ) . '"/></figure><div class="wp-block-media-text__content"><!-- wp:spacer {"height":32} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-about-simple-dark.php

    r52375 r57569  
    55return array(
    66    'title'      => __( 'Simple dark about page', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:cover {"overlayColor":"foreground","minHeight":100,"minHeightUnit":"vh","contentPosition":"center center","align":"full","style":{"spacing":{"padding":{"top":"max(1.25rem, 8vw)","right":"max(1.25rem, 8vw)","bottom":"max(1.25rem, 8vw)","left":"max(1.25rem, 8vw)"}}}} -->
    99                    <div class="wp-block-cover alignfull has-foreground-background-color has-background-dim" style="padding-top:max(1.25rem, 8vw);padding-right:max(1.25rem, 8vw);padding-bottom:max(1.25rem, 8vw);padding-left:max(1.25rem, 8vw);min-height:100vh"><div class="wp-block-cover__inner-container"><!-- wp:navigation {"layout":{"type":"flex","setCascadingProperties":true,"justifyContent":"right"},"overlayMenu":"always"} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-about-solid-color.php

    r52392 r57569  
    55return array(
    66    'title'      => __( 'About page on solid color background', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"1.25rem","right":"1.25rem","bottom":"1.25rem","left":"1.25rem"}}}} -->
    99                    <div class="wp-block-group alignfull" style="padding-top:1.25rem;padding-right:1.25rem;padding-bottom:1.25rem;padding-left:1.25rem"><!-- wp:cover {"overlayColor":"secondary","minHeight":80,"minHeightUnit":"vh","isDark":false,"align":"full"} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-layout-image-and-text.php

    r56613 r57569  
    55return array(
    66    'title'      => __( 'Page layout with image and text', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--large, 8rem)","bottom":"2rem"}}},"layout":{"inherit":true}} -->
    99                <div class="wp-block-group alignfull" style="padding-top:var(--wp--custom--spacing--large, 8rem);padding-bottom:2rem"><!-- wp:heading {"align":"wide","style":{"typography":{"fontSize":"clamp(4rem, 8vw, 7.5rem)","lineHeight":"1.15","fontWeight":"300"}}} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-layout-image-text-and-video.php

    r56613 r57569  
    55return array(
    66    'title'      => __( 'Page layout with image, text and video', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--large, 8rem)","bottom":"var(--wp--custom--spacing--large, 8rem)"}}},"backgroundColor":"primary","textColor":"background"} -->
    99                    <div class="wp-block-group alignfull has-background-color has-primary-background-color has-text-color has-background" style="padding-top:var(--wp--custom--spacing--large, 8rem);padding-bottom:var(--wp--custom--spacing--large, 8rem)"><!-- wp:group {"layout":{"inherit":true}} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-layout-two-columns.php

    r52555 r57569  
    55return array(
    66    'title'      => __( 'Page layout with two columns', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--large, 8rem)","bottom":"var(--wp--custom--spacing--large, 8rem)"}}},"layout":{"inherit":true}} -->
    99                    <div class="wp-block-group alignfull" style="padding-top:var(--wp--custom--spacing--large, 8rem);padding-bottom:var(--wp--custom--spacing--large, 8rem);"><!-- wp:heading {"level":1,"align":"wide","style":{"typography":{"fontSize":"clamp(4rem, 15vw, 12.5rem)","lineHeight":"1","fontWeight":"200"}}} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-sidebar-blog-posts-right.php

    r56613 r57569  
    55return array(
    66    'title'      => __( 'Blog posts with right sidebar', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--small, 1.25rem)","bottom":"var(--wp--custom--spacing--small, 1.25rem)"}}},"layout":{"inherit":true}} -->
    99                    <div class="wp-block-group alignfull" style="padding-top:var(--wp--custom--spacing--small, 1.25rem);padding-bottom:var(--wp--custom--spacing--small, 1.25rem)"><!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"bottom":"2rem","top":"0px","right":"0px","left":"0px"}}},"layout":{"type":"flex","justifyContent":"space-between"}} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-sidebar-blog-posts.php

    r52555 r57569  
    55return array(
    66    'title'      => __( 'Blog posts with left sidebar', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--small, 1.25rem)","bottom":"var(--wp--custom--spacing--small, 1.25rem)"}}},"layout":{"inherit":true}} -->
    99                    <div class="wp-block-group alignfull" style="padding-top:var(--wp--custom--spacing--small, 1.25rem);padding-bottom:var(--wp--custom--spacing--small, 1.25rem)"><!-- wp:columns {"align":"wide","style":{"spacing":{"margin":{"top":"0px","bottom":"0px"},"blockGap":"5%"},"elements":{"link":{"color":{"text":"var:preset|color|primary"}}}},"textColor":"primary"} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-sidebar-grid-posts.php

    r52555 r57569  
    55return array(
    66    'title'      => __( 'Grid of posts with left sidebar', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--custom--spacing--small, 1.25rem)","bottom":"var(--wp--custom--spacing--small, 1.25rem)"}}},"layout":{"inherit":true}} -->
    99                    <div class="wp-block-group alignfull" style="padding-top:var(--wp--custom--spacing--small, 1.25rem);padding-bottom:var(--wp--custom--spacing--small, 1.25rem)"><!-- wp:columns {"align":"wide","style":{"spacing":{"margin":{"top":"0px","bottom":"0px"}}}} -->
  • trunk/src/wp-content/themes/twentytwentytwo/inc/patterns/page-sidebar-poster.php

    r56613 r57569  
    55return array(
    66    'title'      => __( 'Poster with right sidebar', 'twentytwentytwo' ),
    7     'categories' => array( 'pages' ),
     7    'categories' => array( 'twentytwentytwo_pages' ),
    88    'content'    => '<!-- wp:group {"align":"full","layout":{"inherit":true}} -->
    99                    <div class="wp-block-group alignfull"><!-- wp:columns {"align":"wide","style":{"spacing":{"blockGap":"5%"}}} -->
Note: See TracChangeset for help on using the changeset viewer.