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

why get_style_depends() is final mehtod? #3494

Closed
guytzhak opened this issue Feb 16, 2018 · 4 comments
Closed

why get_style_depends() is final mehtod? #3494

guytzhak opened this issue Feb 16, 2018 · 4 comments
Labels
type/developer-api Indicates when a topic is related to the Developer API and Documentation.

Comments

@guytzhak
Copy link

Hi,
The method 'get_style_depends' is final methor dislike the method 'get_script_depends' that isn't final method and help to add depends foreach widget.

why is that? Why you do doesn't let to add custom styles for widgets only if they arer calling?

Thanks

@KingYes
Copy link
Member

KingYes commented Feb 19, 2018

You need to use with add_style_depends() method to add styles.

@tristanleboss
Copy link

tristanleboss commented Feb 19, 2018

I have the same question... I don't understand why for scripts we can override get_script_depends but not for styles (get_style_depends). These methods are exactly the same: they work on two arrays depended_styles and depended_scripts. These arrays are used by two twin functions get_style_depends and get_script_depends which are in turn used by two twin functions enqueue_styles and enqueue_scripts.

Btw, it would be cool to have 2 functions add_style_depends_frontend and add_style_depends_editor or, even better, a parameter (editor, frontend, both) for the actual functions to let the system know when the script/style has to be included. Because today, I didn't find a clean way to separate the scripts for the frontend and the editor. Maybe, I missed something?

@guytzhak
Copy link
Author

@KingYes
Understand, But like @tristanleboss said. it could make us confused when it doesn't work like 'get_script_depends' function.

Thanks!

@KingYes
Copy link
Member

KingYes commented Feb 25, 2018

Thanks @guytzhak @tristanleboss

@bainternet bainternet added the type/developer-api Indicates when a topic is related to the Developer API and Documentation. label Feb 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/developer-api Indicates when a topic is related to the Developer API and Documentation.
Projects
None yet
Development

No branches or pull requests

4 participants