MickeyKay / better-font-awesome-library

[WordPress] The easiest way to integrate Font Awesome into your WordPress theme or plugin.
34 stars 13 forks source link

setup_fallback_data() has filter for directory, needs one for for url as well #6

Open ghost opened 8 years ago

ghost commented 8 years ago

When using the bfa_fallback_directory_path filter in private function setup_fallback_data(), it is possible to specify an own fallback Font Awesome directory. Works fine, extracts the version from a supplied package.json, adds it to URL, etc.

But the URL to stylesheet still links to default fallback, no filter available for this.

Suggested fix, replace this:

        $this->fallback_data['url'] = $this->root_url . $this->fallback_data['directory'] . 'css/font-awesome' . $this->get_min_suffix() . '.css';

With this:

        $directory_uri = $this->root_url . $this->fallback_data['directory'];
        $directory_uri = trailingslashit( apply_filters( 'bfa_fallback_directory_uri', $directory_uri ) );
        $this->fallback_data['url'] = $directory_uri . 'css/font-awesome' . $this->get_min_suffix() . '.css';

This adds new filter bfa_fallback_directory_uri which then can be used in addition to above filter to supply the correct URL to stylesheet.

MickeyKay commented 8 years ago

Fantastic feedback, thanks @tkes. Any chance you'd be willing to file a PR and I can add a credit to you in the plugin readme? That just makes it simpler for me to review and merge.