[wp-trac] [WordPress Trac] #60575: Refactor: `data_wp_context` function does not follow WP standards.
WordPress Trac
noreply at wordpress.org
Wed Feb 21 13:16:40 UTC 2024
#60575: Refactor: `data_wp_context` function does not follow WP standards.
--------------------------------------+---------------------
Reporter: cbravobernal | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.5
Component: Editor | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch dev-feedback | Focuses:
--------------------------------------+---------------------
Comment (by swissspidy):
Actually, in the places the function is currently used in core
(`render_block_core_search` and `WP_Navigation_Block_Renderer`, it's not
used in printing, just returning.
I don't really see value in `data_wp_context` returning the whole `data-
wp-context="..."` attribute string. This could just as well return only
the encoded attribute value.
Then we could name the function `wp_interactivity_encode_context( array
$context, string $store_namespace );` and users would do `data-wp-
context=" . wp_interactivity_encode_context(...) . "` (or with sprintf or
the HTML API or whatever)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60575#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list