Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow plugins to filter _wpCustomizePostsExports js var #343

Closed
entr opened this issue Jan 25, 2017 · 7 comments

Comments

Projects
None yet
2 participants
@entr
Copy link
Contributor

commented Jan 25, 2017

I realize it may be done simply by placing an additional wp_scripts()->add_data() but allowing filtering the $exports seems like a neater approach.

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Jan 25, 2017

For what purpose? What is the use case?

@entr

This comment has been minimized.

Copy link
Contributor Author

commented Jan 25, 2017

One might want to modify the 'l10n' object. I'm aware those are meant to be localized but no good if you need to change the meaning of some items entirely. At least adding stuff to the 'l10n' should be enough reason I think.

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Jan 25, 2017

@entr what's an example of a property that you'd want to change? This is supposed to be accounted for already by allowing additional labels to be supplied in the calls to register_post_type(). For example if you want to override “Content” to appear as “Name” you can do so by supplying 'title_field' => __( 'Name', '…' ) among the labels for the registered post type. You can see how this ends up getting used in JS:

label: postTypeObj.labels.title_field ? postTypeObj.labels.title_field : api.Posts.data.l10n.fieldTitleLabel,

@entr

This comment has been minimized.

Copy link
Contributor Author

commented Jan 25, 2017

OK, that makes perfect sense for the post types. But what about the root l10n object. I wanted to mod the sectionCustomizeActionTpl property, but wait a sec. Is that supposed to be part of WP_Customize_Post_Section::json() in the first place?

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Jan 25, 2017

It should probably be able to be defined among the labels of a registered post type as well to override the default.

@entr

This comment has been minimized.

Copy link
Contributor Author

commented Jan 25, 2017

Yep, that sounds good.

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Jan 25, 2017

Cool. Want to submit a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.