User tests: Successful: Unsuccessful:
Removes custom code in JLanguageMultilang::isEnabled()
in favour of JPluginHelper::isEnabled('system', 'languagefilter')
.
None.
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
I was going to suggest to do exactly the opposite...
getSiteHomePages()
At first time I disagree with you but I can see it as:
languagefilter
JMultilang::setLanguageFilter(true);
JMultilang::enable();
JMultilang::getLanguageFilter();
JMultilang::isEnabled();
Personally I would like to use $app->getLanguageFilter(); everywhere and whole JLanguageMultilang class should be deprecated.
The admin app doesn't use that, only the site app. But JPluginHelper::isEnabled('system', 'languagefilter') can be used everywhere, as i proposed in PR #13159, but was rejected ....
Direct using JPluginHelper::isEnabled('system', 'languagefilter') is not a good idea because someone may want to write own plugin ex. languagefilter2.
@andrepereiradasilva how about setting one more flag (default = false) in the app, and then calling the plugin in the stack will change that value (if multilingual enabled) using JMultilang::enable(); ??
e.g. after https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/application/site.php#L28
First: as @csthomas, my opinion, is that JLanguageMultilang
class should be deprecated and their methods moved to JLanguageHelper (if needed).
IIRC, there are 3 methods doing basicly the same thing ...:
JApplicationSite::(get/set)LanguageFilter()
https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/application/site.php#L591-L604JLanguageMultilang::isEnabled()
the one in this PRJPluginHelper::isEnabled('system', 'languagefilter')
that is a transversal method to check if any plugin is enabled.This IMO is not the best scenario.
Direct using JPluginHelper::isEnabled('system', 'languagefilter') is not a good idea because someone may want to write own plugin ex. languagefilter2.
And? What is different from now?
@andrepereiradasilva how about setting one more flag (default = false) in the app, and then calling the plugin in the stack will change that value (if multilingual enabled) using JMultilang::enable(); ??
From an architectural point, why should the app have an hardcode dependency with the language filter plugin? Isn't it a plugin like any other?
First: as @csthomas, my opinion, is that JLanguageMultilang class should be deprecated and their methods moved to JLanguageHelper (if needed).
Agree
IIRC, there are 3 methods doing basicly the same thing ...:
JApplicationSite::(get/set)LanguageFilter() https://github.com/joomla/joomla-cms/blob/staging/libraries/cms/application/site.php#L591-L604 JLanguageMultilang::isEnabled() the one in this PR JPluginHelper::isEnabled('system', 'languagefilter') that is a transversal method to check if any plugin is enabled.
This IMO is not the best scenario.
Agree
Direct using JPluginHelper::isEnabled('system', 'languagefilter') is not a good idea because someone may want to write own plugin ex. languagefilter2.
And? What is different from now?
Use JLanguageMultilang::isEnabled()
and JLanguageMultilang::enable()
or better move that functionality to JLanguageHelper
. I suggest methods like:
isMultilang()
and setMultilang($enable = true)
Plugin at least need to call JLanguageHelper::setMultilang()
.
From now we can replace JLanguageMultilang::isEnabled()
with JLanguageHelper::isMultilang()
@andrepereiradasilva how about setting one more flag (default = false) in the app, and then calling the plugin in the stack will change that value (if multilingual enabled) using JMultilang::enable(); ??
From an architectural point, why should the app have an hardcode dependency with the language filter plugin? Isn't it a plugin like any other?
IMHO should not.
Should only base on JLanguageHelper::isMultilang()
JLanguageMultilang::getSiteHomePages()
probably should be move to somewhere...
Why change something that works perfectly and has always worked since it was implemented?
IMHO changing for the sake of changing is not a good idea.
IMO "works perfectly" is amatter of opinion, and is not equal to "not touch for ever".
The change proposed is not just for the sake of changing, i have better things to do than moving code around:
I was unclear in my comment. For me this PR is fine. I was commenting on the other proposals.
further analysing actually this PR will not work, because a user without access to language filter would not be able to see multilangue features.
So will close this
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-01-02 18:40:50 |
Closed_By | ⇒ | andrepereiradasilva |
Personally I would like to use
$app->getLanguageFilter();
everywhere and wholeJLanguageMultilang
class should be deprecated.