Opened 12 years ago
Closed 12 years ago
#27315 closed enhancement (fixed)
Easier adding of custom class variables when extending WP_Customize_Section
| Reported by: | rhurling | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.0 |
| Component: | Customize | Version: | 3.4 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: | administration |
Description (last modified by )
WP_Customize_Section uses $keys = array_keys( get_class_vars( __CLASS__ ) ); to set class variables, but WP_Customize_Control uses $keys = array_keys( get_object_vars( $this ) ); to set class variables.
The difference is that if you extend WP_Customize_Control you can add new class variables by setting them in the extended class and passing them to the args array in the constructor.
In WP_Customize_Section one has to override the constructor to do the same.
changing
$keys = array_keys( get_class_vars( __CLASS__ ) );
to
$keys = array_keys( get_object_vars( $this ) );
in WP_Customize_Section would solve the problem (or use the static keyword which would raise the requirements to PHP 5.3)
Attachments (1)
Change History (8)
#2
@
12 years ago
- Description modified (diff)
- Keywords good-first-bug needs-patch added
- Milestone Awaiting Review → Future Release
- Version 3.8.1 → 3.4
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Agreed.
get_class_vars( __CLASS__ )should be replaced withget_object_vars( $this ). This would actually bringWP_Customize_Sectionin lineWP_Customize_Controlwhich initially did useget_class_vars()but in [20319] was changed to useget_object_vars().