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
Contributor

entr 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.

Show comment
Hide comment
@westonruter

westonruter Jan 25, 2017

Contributor

For what purpose? What is the use case?

Contributor

westonruter commented Jan 25, 2017

For what purpose? What is the use case?

@entr

This comment has been minimized.

Show comment
Hide comment
@entr

entr Jan 25, 2017

Contributor

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.

Contributor

entr 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.

Show comment
Hide comment
@westonruter

westonruter Jan 25, 2017

Contributor

@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,

Contributor

westonruter 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.

Show comment
Hide comment
@entr

entr Jan 25, 2017

Contributor

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?

Contributor

entr 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.

Show comment
Hide comment
@westonruter

westonruter Jan 25, 2017

Contributor

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

Contributor

westonruter 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.

Show comment
Hide comment
@entr

entr Jan 25, 2017

Contributor

Yep, that sounds good.

Contributor

entr commented Jan 25, 2017

Yep, that sounds good.

@westonruter

This comment has been minimized.

Show comment
Hide comment
@westonruter

westonruter Jan 25, 2017

Contributor

Cool. Want to submit a pull request?

Contributor

westonruter 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