[wp-trac] [WordPress Trac] #12267: Upgrade loop objects to provide identical presentational interfaces.

WordPress Trac wp-trac at lists.automattic.com
Wed Mar 9 03:24:16 UTC 2011


#12267: Upgrade loop objects to provide identical presentational interfaces.
-------------------------+-----------------------------
 Reporter:  andy         |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  3.2-early    |
-------------------------+-----------------------------

Comment (by hakre):

 Replying to [comment:42 filosofo]:
 > Also, I think this in addition to making things devilishly hard to
 debug, misses one of the big benefits of this proposal, which is having
 the same set of standard properties and methods across different types of
 objects.
 >
 > For example, I want to be able to be able to return all sorts of objects
 after a search.  Then I should be able to iterate over all of them with
 links and summaries, etc., agnostic about the particular kind of object
 returned.  That way categories, posts, pages, custom post types, etc., can
 all be part of the Loop and use the same link, headline, and paragraph
 markup.

 I suggest a [http://php.net/manual/en/language.oop5.interfaces.php
 standard interface] any type can implement and therefore be compatible.

 As post types (content data) have a lot of dynamic properties I suggest
 some kind of [http://php.net/manual/en/language.oop5.abstract.php
 ''abstract'' base class] as well and an abstract visitor base class. That
 should offer a lot of flexibility in conjunction with the interface.

 IMHO dynamic properties are very important because basically you don't
 need many classes but normaly only one class with dynamic properties as
 all the data-types are basically the same. More or less simple data
 objects.

 I see this as a slow evolution: from the arrays and later on standard
 classes we've been using in core for posts and pages as prototype models
 so far for the last 7 years.

 The magic methods and array access as well as iterators from the spl can
 help to keep things fluid. Defer the details, just make use of standard
 PHP, there's already a lot done.

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


More information about the wp-trac mailing list