[wp-trac] [WordPress Trac] #43728: Implements site_enable_theme and site_disable_theme functions in WP_Theme class

WordPress Trac noreply at wordpress.org
Tue Apr 10 09:26:45 UTC 2018


#43728: Implements site_enable_theme and site_disable_theme functions in WP_Theme
class
-------------------------+------------------------------
 Reporter:  Mista-Flo    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Themes       |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  multisite
-------------------------+------------------------------
Changes (by flixos90):

 * keywords:  has-patch =>


Comment:

 Replying to [comment:1 swissspidy]:
 > What about something like `WP_Site::enable_theme( WP_Theme $theme )`?
 and `WP_Network::enable_theme( WP_Theme $theme )` (or
 `WP_Network::enable_theme( string $stylesheet )`) instead of `WP_Theme::
 network_disable_theme( $stylesheets )`.

 That's a good idea to consider. I'm not sure we wanna go that route yet
 though, as we'd need to discuss whether `WP_Site` and `WP_Network` should
 be more than representations of their core data. The common pattern
 currently is to have functions that access those objects as necessary, not
 methods on those objects that then do logic. If we went this approach,
 we'd also open up possible `WP_Network::*_option()` methods and many more,
 which eventually would cause the classes to be way too large.

 I can see where your idea comes from, and it's kind of a shame that
 `WP_Theme` includes those methods because they only really make sense in
 multisite - if it wasn't for legacy, I'd go with a factory that would use
 another class in multisite that has those methods, but in single-site they
 wouldn't be available.

 I suggest for now, mostly for consistency, we go with methods on
 `WP_Theme`. Alternative patterns involving `WP_Site` and `WP_Network`
 could still be implemented at a later stage.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43728#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list