[wp-trac] [WordPress Trac] #24770: Function "do_items" calls "do_item" with an unexpected parameter

WordPress Trac noreply at wordpress.org
Tue Jul 16 19:03:46 UTC 2013


#24770: Function "do_items" calls "do_item" with an unexpected parameter
---------------------------------------------------+----------------------
 Reporter:  riccardo.raneri                        |       Owner:
     Type:  defect (bug)                           |      Status:  closed
 Priority:  normal                                 |   Milestone:
Component:  General                                |     Version:  2.8
 Severity:  normal                                 |  Resolution:  invalid
 Keywords:  needs-patch 2nd-opinion needs-testing  |
---------------------------------------------------+----------------------
Changes (by azaozz):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 This is simple class inheritance. The `do_item()` method in
 [http://core.trac.wordpress.org/browser/trunk/wp-includes/class.wp-
 dependencies.php#L59 class.wp-dependencies.php] is a placeholder meant to
 be overwritten when extending the class. When handling scripts
 [http://core.trac.wordpress.org/browser/trunk/wp-includes/class.wp-
 scripts.php#L19 WP_Dependencies is extended with WP_Scripts]. So
 `$this->do_item()` executes the `do_item()` method of
 [http://core.trac.wordpress.org/browser/trunk/wp-includes/class.wp-
 scripts.php#L77 WP_Scripts] that expects the second argument. (The
 WP_Dependencies::do_item() is still used in WP_Scripts but note how it's
 called with `parent::do_item($handle)`.)

 Not sure what exactly you're trying to do but enqueueing `'jquery-ui-
 core'` works as expected. It outputs jquery.js, jquery-migrate.js (in 3.6
 only), and jquery.ui.core.min.js. However jQuery UI core by itself
 wouldn't do anything, it's a common component/requirement for the other UI
 components. For example if you want to use UI accordion, you'll need to
 also add UI core and widget.

 In WordPress this is handled by wp_enqueue_script(). To use accordion you
 only need to enqueue `'jquery-ui-accordion'`. All other scripts that
 accordion depends on will be added automatically.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/24770#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list