Skip to content

Add ability to use filters in Extension Customizer #3285

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

Closed
wants to merge 1 commit into from
Closed

Add ability to use filters in Extension Customizer #3285

wants to merge 1 commit into from

Conversation

aaronhuisinga
Copy link

Hey Redux team!
I've come across an issue that has been reported before, but a non-BC breaking PR has never been opened. I think this takes care of fixing both my issue, and also not breaking anything for existing Redux users.

The problem:
Users of Bedrock (https://github.com/roots/bedrock) are unable to use the Customizer for themes that take advantage of Redux. This is due to the usage of a non-standard plugins directory location (and I believe a symlink) which causes the required Customizer files (extension_customizer.css and extension_customizer.js) to not load properly, as the _extension_dir and _extension_url variables are incorrect for Bedrock installations.

The solution:
Following the pre-existing pattern of using filters within Redux (I followed the example of the existing redux/_url and redux/_dir filters), I've simply added the ability to define filters to customize these values when necessary. This keeps existing behavior the same for users, and allows developers making use of non-standard WordPress installs to still be able to support Redux in custom configurations without needing to edit the Redux source code.

Related Issues I Referenced:
#2519 and #2754

@kprovance
Copy link
Member

Not out of the question. My only concern is the path naming. While this works for the extension in the core, the same filter on premium extensions, housed outside of the core fail. So we'd have to add in the extension name...and since multiple instances of Redux are possible, potentially each with their own premium extensions, the opt_name variable would need to go in as well. Gotta think big picture. I'll play with this later this week and make sure such a naming convention works in all of these scenarios.

@aaronhuisinga
Copy link
Author

@kprovance Thanks! Let me know if there are any adjustments you'd like me to make in order to be considered for a merge. I'm happy to help.

@krombox
Copy link

krombox commented Jun 16, 2017

@aaronhuisinga thanks for PR. Your solution is what helped me in similar situation. I am not using bedrock, but i am using custom WP and WP_CONTENT_DIR folders to manage dependencies via composer.

@kprovance Does this PR will be on master branch at some point? Thanks

@dahaupt
Copy link

dahaupt commented Jun 27, 2018

@kprovance I just ran into this issue using Bedrock within my local environment using ddev.

It failed to load some resources e.g.
http://mypage.ddev.local/wp/var/www/html/web/app/plugins/redux-framework/ReduxCore/inc/extensions/customizer/extension_customizer.js

The link should instead be
http://mypage.ddev.local/app/plugins/redux-framework/ReduxCore/inc/extensions/customizer/extension_customizer.js

Anything we can do here to help fixing this behavior? Bedrock seems really great for starting WordPress projects.

@kprovance
Copy link
Member

Manually added and credited. Final filters are as noted:

$this->_extension_dir = apply_filters( "redux/extension/customizer/dir", trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) ) );
$this->_extension_url = apply_filters( "redux/extension/customizer/url", site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->_extension_dir ) ) );

@kprovance kprovance closed this Aug 9, 2018
kprovance added a commit that referenced this pull request Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants