|Reported by:||kitchin||Owned by:||DrewAPicture|
The code in wp-includes/class.wp-dependencies.php needs better documentation. Three confusions in particular:
- $args has a different meaning in WP_Dependencies and _WP_Dependency. In the first, it is a way to append query strings to the URL's. In the second it is a generic 5th parameter used by the API functions wp_register_*() and wp_enqueue_*(). In class WP_Styles it stands for $media. In class WP_Scripts it stands for $in_footer.
- $handle sometimes means the registered handle, and other times means handle?args.
- $group stands for page placement in WP_Styles (0=header, 1=footer), and is unused in WP_Scripts (false). But a prominent comment uses the word "Groups" to describe something entirely different, a registered item with dependencies but no src. In my proposed documentation I use the word "Alias" for this meaning. An example of an alias is in wp-includes/script-loader.php:
add( 'scriptaculous', false, array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls') );
Patch attached. No code changes.
An example of contributors not knowing about Confusion 2 is #13078.
Change History (16)
comment:1 DrewAPicture — 9 months ago
- Component changed from Template to Text Changes
- Version trunk deleted
comment:9 DrewAPicture — 3 months ago
- Owner set to DrewAPicture
- Resolution set to fixed
- Status changed from new to closed
Note: See TracTickets for help on using tickets.