kayue / KayueWordpressBundle

A Symfony 2 bundle for providing WordPress repositories and authenticating users (login).
101 stars 43 forks source link

Codex backwards compatibilty in Twig in order to port more functions #32

Closed rvanlaak closed 9 years ago

rvanlaak commented 10 years ago

Currently the most used class I make use of is the WordpressTwigExtension from the deprecated predecessor of this library. In my opinion this extension worked great because it enabled me to very easily integrate Wordpress in my Symfony application. https://github.com/kayue/WordpressBundle/blob/master/Extensions/WordpressTwigExtension.php

I see you've removed the magic __call() function from the current WordpressTwigExtension, which took care of handling all known Codex functions in Twig https://github.com/kayue/KayueWordpressBundle/blob/master/Twig/Extension/WordpressExtension.php

For the sake of backwards compatibility, wouldn't it be a good idea to reintroduce the magic function? Probably the most important reason for not doing this is because then the entire core has to be loaded?

I think it always will be needed to wake up the core, since there are a lot of plugins that add hooks to the functions, and introduce their own functions. Take the WPML internationalization plugin as example, which adds hooks to determine the correct language.

Do you've got another idea how to take care of the hooks, aside of adding the magic __call() again?

kayue commented 10 years ago

@Rvanlaak two bundle use a different approach. The first one (HypebeastWordpressBundle) loads entire WordPress into Symfony, thus you can reuse almost everything in WordPress. This is good if you want to reuse your code from WordPress, but it also introduced other issues. It is like loading two framework in one website.

However in the new KayueWordpressBundle it does not require WordPress at all. It just read the WordPress database. So it is impossible to add back the magic methods because in this bundle we do not load any WordPress functions at all.

I suggest you continue to use HypebeastWordpressBundle if you want to reuse WordPress functions.

rvanlaak commented 10 years ago

I understand your point of view, but in that case you can't deprecate the other library right? What do you actually think about the hooks all plugins add?

kayue commented 10 years ago

@Rvanlaak You are right. I just aren't maintaining the other library anymore.

I only use WordPress plugin to enhance backend, this is why KayueWordpressBundle works well for me.