Make WordPress Core


Ignore:
Timestamp:
06/14/2024 09:03:40 AM (2 years ago)
Author:
oandregal
Message:

Section styles: add slug to override non-kebab-cased variations.

Props aaronrobertshaw, oandregal.
Fixes #61440.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/block-style-variations.php

    r58394 r58413  
    250250         * need to have their name set to the kebab case version of their title.
    251251         */
    252         $variation_name = $have_named_variations ? $key : _wp_to_kebab_case( $variation['title'] );
     252        $variation_name = $have_named_variations ? $key : ( $variation['slug'] ?? _wp_to_kebab_case( $variation['title'] ) );
    253253
    254254        foreach ( $supported_blocks as $block_type ) {
     
    442442         * need to have their name set to the kebab case version of their title.
    443443         */
    444         $variation_name  = $have_named_variations ? $key : _wp_to_kebab_case( $variation['title'] );
     444        $variation_name  = $have_named_variations ? $key : ( $variation['slug'] ?? _wp_to_kebab_case( $variation['title'] ) );
    445445        $variation_label = $variation['title'] ?? $variation_name;
    446446
Note: See TracChangeset for help on using the changeset viewer.