[wp-trac] [WordPress Trac] #15061: Allow either array or string to be passed to locate_template

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 11 01:37:11 UTC 2010


#15061: Allow either array or string to be passed to locate_template
--------------------------+-------------------------------------------------
 Reporter:  chrisbliss18  |        Owner:  scribu  
     Type:  enhancement   |       Status:  reopened
 Priority:  normal        |    Milestone:  3.1     
Component:  Template      |      Version:          
 Severity:  normal        |   Resolution:          
 Keywords:  has-patch     |  
--------------------------+-------------------------------------------------
Changes (by hakre):

  * status:  closed => reopened
  * resolution:  fixed =>


Comment:

 I don't like these casts to arrays in foreach. This prevent usage with
 other iterators in the future. Instead, we just could add a function that
 does the job with a single string.

 Adding complexity (a parameter with two meanings at once) is not only
 about performance problems. Infact, performance is a no-brainer here: It
 just does not count. The major problem is that this patch makes the code
 harder to understand, but the ticket asks for easier code.

 Don't get me wrong. The cast might look as a nice pinch on first sight but
 the headaches come later.

 The tickets motivation is valid in the best sense: Why to pass an array if
 a string does the job for one template identifier?

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


More information about the wp-trac mailing list