Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#27979 closed enhancement (fixed)

Pass Customizer Setting instance to `customize_update_` and `customize_preview_`

Reported by: danielbachhuber's profile danielbachhuber Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.0 Priority: normal
Severity: normal Version:
Component: Customize Keywords: good-first-bug has-patch commit
Focuses: Cc:

Description

The customize_update_ and customize_preview_ actions would benefit from having the setting instance passed to them. When using a custom type, it would be helpful to have a reference as to which setting is being saved in case a common callback is being used to save / preview all settings of a given custom type.

Attachments (4)

class-wp-customize-setting.php (13.8 KB) - added by tormorten 11 years ago.
27979.patch (724 bytes) - added by dustyn 11 years ago.
27979.2.patch (983 bytes) - added by dustyn 11 years ago.
27979.3.patch (1011 bytes) - added by DrewAPicture 11 years ago.

Download all attachments as: .zip

Change History (15)

#1 @celloexpressions
11 years ago

  • Component changed from General to Appearance

Huge +1. I'm running into this with my Menu Customizer GSoC project, and the setting instance provides good context when performing the types of operations that occur frequently with custom setting types.

I'll upload a patch if no one grabs the good-first-bug in the next couple days. It's a good first bug in its simple fix and being self-contained, although this is a fairly advanced concept in terms of finding and understanding it.

#2 @SergeyBiryukov
11 years ago

  • Milestone changed from Future Release to 4.0

#3 @celloexpressions
11 years ago

Hi tormorten,

Thanks for looking into this. A few notes:

  • Rather than upload the whole file, can you create a patch from the WordPress root? We use patches so that it's easier to review and commit changes.
  • Be sure to update the inline documentation to include the new parameter (something like @param WP_Customize_Setting $this WP_Customize_Setting instance.).
  • When you upload patches in the future, be sure to leave a comment and add the "has-patch" keyword to the ticket. Attaching files doesn't send notifications, only comments do, and adding has-patch will help with the review process.

If you have any questions, feel free to ask for clarification!

This ticket was mentioned in IRC in #wordpress-dev by salcode. View the logs.


11 years ago

@dustyn
11 years ago

#5 @dustyn
11 years ago

Added patch @wcphilly devday

@dustyn
11 years ago

#6 @celloexpressions
11 years ago

  • Keywords has-patch added; needs-patch removed

Looks good to go.

#7 @helen
11 years ago

  • Keywords commit added

This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.


11 years ago

#9 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 28767:

Pass WP_Customize_Setting instance to 'customize_preview_*' and 'customize_update_*' actions.

props dustyn, DrewAPicture.
fixes #27979.

#10 @danielbachhuber
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

do_action( 'customize_save_' . $this->id_data[ 'base' ] ); would benefit as well.

#11 @SergeyBiryukov
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 28769:

Pass WP_Customize_Setting instance to 'customize_save_*' action.

props danielbachhuber.
fixes #27979.

Note: See TracTickets for help on using tickets.