Skip to content

Commit cfc881a

Browse files
authored
Chore: renaming functions to fit 6.1 (#44266)
1 parent 56c97e8 commit cfc881a

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

lib/compat/wordpress-6.1/theme.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function gutenberg_create_initial_theme_features() {
3030
}
3131
add_action( 'setup_theme', 'gutenberg_create_initial_theme_features', 0 );
3232

33-
if ( ! function_exists( 'wp_theme_element_class_name' ) ) {
33+
if ( ! function_exists( 'wp_theme_get_element_class_name' ) ) {
3434
/**
3535
* Given an element name, returns a class name.
3636
* Alias from WP_Theme_JSON_Gutenberg::get_element_class_name.
@@ -41,7 +41,7 @@ function gutenberg_create_initial_theme_features() {
4141
*
4242
* @since 6.1.0
4343
*/
44-
function wp_theme_element_class_name( $element ) {
44+
function wp_theme_get_element_class_name( $element ) {
4545
return WP_Theme_JSON_Gutenberg::get_element_class_name( $element );
4646
}
4747
}

packages/block-library/src/comments/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function register_block_core_comments() {
109109
*/
110110
function comments_block_form_defaults( $fields ) {
111111
if ( wp_is_block_theme() ) {
112-
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link ' . wp_theme_element_class_name( 'button' ) . '" value="%4$s" />';
112+
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link ' . wp_theme_get_element_class_name( 'button' ) . '" value="%4$s" />';
113113
$fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
114114
}
115115

packages/block-library/src/post-comments-form/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function register_block_core_post_comments_form() {
7272
*/
7373
function post_comments_form_block_form_defaults( $fields ) {
7474
if ( wp_is_block_theme() ) {
75-
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="wp-block-button__link ' . wp_theme_element_class_name( 'button' ) . '" value="%4$s" />';
75+
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="wp-block-button__link ' . wp_theme_get_element_class_name( 'button' ) . '" value="%4$s" />';
7676
$fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
7777
}
7878

packages/block-library/src/post-featured-image/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function get_block_core_post_featured_image_border_attributes( $attributes ) {
175175
);
176176
}
177177

178-
$styles = gutenberg_style_engine_get_styles( array( 'border' => $border_styles ) );
178+
$styles = wp_style_engine_get_styles( array( 'border' => $border_styles ) );
179179
$attributes = array();
180180
if ( ! empty( $styles['classnames'] ) ) {
181181
$attributes['class'] = $styles['classnames'];

packages/block-library/src/search/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function render_block_core_search( $attributes ) {
121121
}
122122

123123
// Include the button element class.
124-
$button_classes[] = wp_theme_element_class_name( 'button' );
124+
$button_classes[] = wp_theme_get_element_class_name( 'button' );
125125
$button_markup = sprintf(
126126
'<button type="submit" class="%s" %s %s>%s</button>',
127127
esc_attr( implode( ' ', $button_classes ) ),

phpunit/class-wp-theme-json-test.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,14 +797,14 @@ function test_remove_invalid_element_pseudo_selectors() {
797797

798798
function test_get_element_class_name_button() {
799799
$expected = 'wp-element-button';
800-
$actual = wp_theme_element_class_name( 'button' );
800+
$actual = WP_Theme_JSON_Gutenberg::get_element_class_name( 'button' );
801801

802802
$this->assertEquals( $expected, $actual );
803803
}
804804

805805
function test_get_element_class_name_invalid() {
806806
$expected = '';
807-
$actual = wp_theme_element_class_name( 'unknown-element' );
807+
$actual = WP_Theme_JSON_Gutenberg::get_element_class_name( 'unknown-element' );
808808

809809
$this->assertEquals( $expected, $actual );
810810
}

tools/webpack/blocks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const blockViewRegex = new RegExp(
3030
const prefixFunctions = [
3131
'build_query_vars_from_query_block',
3232
'wp_enqueue_block_support_styles',
33+
'wp_style_engine_get_styles',
3334
];
3435

3536
/**

0 commit comments

Comments
 (0)