Skip to content

[Backport] Add wp_theme_element_class_name() alias - #3244

Closed
ockham wants to merge 5 commits into
WordPress:trunkfrom
ockham:backport/wp-theme-element-class-name
Closed

[Backport] Add wp_theme_element_class_name() alias#3244
ockham wants to merge 5 commits into
WordPress:trunkfrom
ockham:backport/wp-theme-element-class-name

Conversation

@ockham

Copy link
Copy Markdown
Contributor

Add wp_theme_element_class_name() alias for the "internal" WP_Theme_JSON::get_element_class_name().

Backport of @c4rl0sbr4v0s' WordPress/gutenberg#44099.

See this discussion for the rationale.

Note that I've opted not to replace calls to WP_Theme_JSON::get_element_class_name in the tests -- since those are specifically for the WP_Theme_JSON class.

Trac ticket: https://core.trac.wordpress.org/ticket/56467


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@cbravobernalcbravobernal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@costdevcostdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two minor suggestions 🙂

Comment threadsrc/wp-includes/theme.php Outdated
Comment threadsrc/wp-includes/theme.php Outdated
*
* @return string The name of the class.
*
* @since 6.1.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: @param and @return should come after @since.

Comment threadsrc/wp-includes/theme.php Outdated
Comment threadsrc/wp-includes/theme.php Outdated
*
* @return string The name of the class.
*/
function wp_theme_element_class_name( $element ) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with the original method, and for consistent use of the active verb, I'd suggest renaming this alias to wp_theme_get_element_class_name(). 🙂

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! That does have a nicer ring to it 😊

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@costdevcostdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@ockham

Copy link
Copy Markdown
ContributorAuthor

Since the unit test errors seem spurious (see), I'll try rebasing to kick them off again.

ockhamand others added 5 commits September 14, 2022 20:14
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com>
@ockham
ockhamforce-pushed the backport/wp-theme-element-class-name branch from 06618d5 to 4c85024CompareSeptember 14, 2022 18:14
@audrasjbaudrasjb self-assigned this Sep 15, 2022
@audrasjb

Copy link
Copy Markdown
Contributor

Committed in https://core.trac.wordpress.org/changeset/54174

@ockham I'll let you close this PR if everything is ok :)

@audrasjb

Copy link
Copy Markdown
Contributor

Oops, I closed it accidentally :D

@ockham

Copy link
Copy Markdown
ContributorAuthor

Oops, I closed it accidentally :D

No worries @audrasjb 😄 Thank you for committing!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

4 participants

@ockham@audrasjb@cbravobernal@costdev