Make WordPress Core

Opened 12 years ago

Last modified 8 years ago

#29316 new enhancement

Need more value and preview hooks for WP_Customize_Settings

Reported by: dedepress Owned by:
Priority: low Milestone: Future Release
Component: Customize Version: 3.4
Severity: normal Keywords: needs-patch
Cc: Focuses:

Description

There should have more filters to handle settings.

for example:
add

apply_filters( 'customize_value', $this->defaults, $this);

or

apply_filters( 'customize_value_'.$this->type, $this->default, $this);

before

apply_filters( 'customize_value_' . $this->id_data[ 'base' ], $this->default );

add

do_action( 'customize_preview_setting', $this );

before

do_action( 'customize_preview_' . $this->id, $this );

Attachments (1)

class-wp-customize-setting.diff (1.6 KB ) - added by mehulkaklotar 11 years ago.

Download all attachments as: .zip

Change History (19)

#1 @SergeyBiryukov
12 years ago

  • Type feature requestenhancement

#2 @ocean90
12 years ago

Related: #29165

#3 @celloexpressions
12 years ago

  • Focuses administration removed
  • Version 3.9.23.4

I don't think we would want to add non-type-specific filters, like customize_value, but customize_value_$this->type might be useful (do you have a specific use-case or example for that?). I'm not sure that it would make sense to apply any filters to all settings regardless of their type, as they are handled very differently depending on their types. But adding filters by type where there are currently only filters by id may be useful depending on the situation (and I think we would need to come up with some use-cases before implementing them).

#4 @dedepress
12 years ago

There is filter by type in WP_Customize_Setting->update(), but filter by id_base in WP_Customize_Setting->value(). so, it's hard to modify something via same type of filters for updating and retrieving.

I think

customize_value_$this->type, $this

is better than

customize_value_' . $this->id_data[ 'base' ], $this->default

assumed all of our setting ids is serialized, how to change value of each setting via the id_base filter? pre_option_* and pre_update_option* can achieved my goal, but filter by type will make things easier.

Last edited 12 years ago by dedepress (previous) (diff)

#5 @westonruter
12 years ago

  • Keywords needs-patch added
  • Milestone Awaiting ReviewFuture Release

The current customize_value_{$id_base} is extremely limited in use. We need the type-based filter as well, and these filters need to be passed the WP_Customize_Setting instance.

#6 @westonruter
12 years ago

  • Milestone Future Release4.2

We need this for Settings with custom types to be able to properly get values when they aren't previewed (since as of [30102], only dirty settings get sent to preview, leaving unchanged settings to rely on the value-filters). Assigning to 4.2 milestone.

#7 @celloexpressions
11 years ago

Needs a patch asap if we're going to make the enhancements deadline Tuesday. This is one of our more punt-able tickets.

#8 @westonruter
11 years ago

  • Type enhancementfeature request

We can punt. It is not technically required since you can just add ID-specific filters.

#9 @westonruter
11 years ago

  • Milestone 4.2Future Release
  • Type feature requestenhancement

#10 @westonruter
11 years ago

#34099 was marked as a duplicate.

Version 0, edited 11 years ago by westonruter (next)

#11 @westonruter
10 years ago

  • Summary Need more filters for WP_Customize_SettingsNeed more value and preview hooks for WP_Customize_Settings

#12 @westonruter
10 years ago

#36452 was marked as a duplicate.

#13 @westonruter
10 years ago

  • Milestone Future Release4.6

This ticket was mentioned in Slack in #core-customize by celloexpressions. View the logs.


10 years ago

#15 @celloexpressions
10 years ago

  • Milestone 4.6Future Release

Let's reevaluate once we have an updated patch.

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.


9 years ago

#17 @westonruter
9 years ago

  • Priority normallow

Marking as low priority since all can be accomplished by subclassing WP_Customize_Setting, which is cleaner anyway and more encapsulated.

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.


8 years ago

Note: See TracTickets for help on using tickets.