Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] Add wp_theme_element_class_name() alias #3244

Closed

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Sep 14, 2022

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.

Copy link
Contributor

@cbravobernal cbravobernal left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@costdev costdev left a comment

Choose a reason for hiding this comment

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

Just two minor suggestions 🙂

src/wp-includes/theme.php Outdated Show resolved Hide resolved
*
* @return string The name of the class.
*
* @since 6.1.0
Copy link
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.

src/wp-includes/theme.php Outdated Show resolved Hide resolved
*
* @return string The name of the class.
*/
function wp_theme_element_class_name( $element ) {
Copy link
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
Contributor Author

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
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@costdev costdev left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@ockham
Copy link
Contributor Author

ockham commented Sep 14, 2022

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

ockham and 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 ockham force-pushed the backport/wp-theme-element-class-name branch from 06618d5 to 4c85024 Compare September 14, 2022 18:14
@audrasjb audrasjb self-assigned this Sep 15, 2022
@audrasjb
Copy link
Contributor

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

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

@audrasjb audrasjb closed this Sep 15, 2022
@audrasjb
Copy link
Contributor

Oops, I closed it accidentally :D

@ockham
Copy link
Contributor Author

ockham commented Sep 15, 2022

Oops, I closed it accidentally :D

No worries @audrasjb 😄 Thank you for committing!

Sign up for free to 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